当前位置: 首页>>代码示例>>Python>>正文


Python Checkbutton.config方法代码示例

本文整理汇总了Python中Tkinter.Checkbutton.config方法的典型用法代码示例。如果您正苦于以下问题:Python Checkbutton.config方法的具体用法?Python Checkbutton.config怎么用?Python Checkbutton.config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tkinter.Checkbutton的用法示例。


在下文中一共展示了Checkbutton.config方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Cockpit

# 需要导入模块: from Tkinter import Checkbutton [as 别名]
# 或者: from Tkinter.Checkbutton import config [as 别名]

#.........这里部分代码省略.........

        self._shiftCanvas.bind("<Button-3>", self._onMouseButton3)
        #self._shiftCanvas.bind("<ButtonRelease-3>", self._onMouseButtonRelease3)
        self._shiftCanvas.bind("<B3-Motion>", self._onMouseButton3Motion)

        self._shiftCanvas.grid(row=0,column=1, padx=2, pady=2)
        self._shiftCanvas.create_oval(2, 2, 400, 400, outline="#ff0000")
        self._shiftCanvas.create_line(201, 2, 201, 400, fill="#ff0000")
        self._shiftCanvas.create_line(2, 201, 400, 201, fill="#ff0000")
        self._shiftMarker = self._shiftCanvas.create_oval(197, 197, 205, 205, outline="#0000ff", fill="#0000ff")
        
        self._yaw = DoubleVar()
        self._yawScale = Scale(controlFrame, orient=HORIZONTAL, from_=-100.0, to=100.0, \
                            tickinterval=0, variable=self._yaw, \
                            length=200, showvalue=1, \
                            command=self._onYawScaleChanged)
        self._yawScale.bind("<Double-Button-1>", self._onYawScaleDoubleButton1, "+")
        self._yawScale.grid(row=1, column=1)
        
        self._controlKeyActive = False
        

        #PID calibration

        pidCalibrationFrame = tkFrame(self)
        pidCalibrationFrame.grid(column=0, row=2, sticky="WE");

        self._pidSelected = StringVar()
        self._pidSelected.set("--")
        self._pidListBox = OptionMenu(pidCalibrationFrame, self._pidSelected, "--", \
                                      Cockpit.KEY_ANG_SPEED, Cockpit.KEY_ANGLES, Cockpit.KEY_ACCEL, \
                                       command=self._onPidListBoxChanged)
        self._pidListBox.pack(side=LEFT, padx=2)
        self._pidListBox.config(width=10)
        
        self._axisSelected = StringVar()
        self._axisSelected.set("--")
        self._axisListBox = OptionMenu(pidCalibrationFrame, self._axisSelected, "--", "X", "Y", "Z", \
                                       command=self._onAxisListBoxChanged)
        self._axisListBox.pack(side=LEFT, padx=2)
        self._axisListBox.config(state=DISABLED)

        Label(pidCalibrationFrame, text="P").pack(side=LEFT, padx=(14, 2))

        self._pidPString = StringVar()
        self._pidPString.set("0.00")
        self._pidPSpinbox = Spinbox(pidCalibrationFrame, width=5, from_=0.0, to=100.0, increment=0.01, state=DISABLED, \
                                         textvariable=self._pidPString, command=self._onPidSpinboxChanged)
        self._pidPSpinbox.pack(side=LEFT, padx=2)

        Label(pidCalibrationFrame, text="I").pack(side=LEFT, padx=(14, 2))

        self._pidIString = StringVar()
        self._pidIString.set("0.00")
        self._pidISpinbox = Spinbox(pidCalibrationFrame, width=5, from_=0.0, to=100.0, increment=0.01, state=DISABLED, \
                                         textvariable=self._pidIString, command=self._onPidSpinboxChanged)
        self._pidISpinbox.pack(side=LEFT, padx=2)
        
        Label(pidCalibrationFrame, text="D").pack(side=LEFT, padx=(14, 2))
        
        self._pidDString = StringVar()
        self._pidDString.set("0.00")
        self._pidDSpinbox = Spinbox(pidCalibrationFrame, width=5, from_=0.0, to=100.0, increment=0.01, state=DISABLED, \
                                         textvariable=self._pidDString, command=self._onPidSpinboxChanged)
        self._pidDSpinbox.pack(side=LEFT, padx=2)
        
开发者ID:hisie,项目名称:eaglebone,代码行数:69,代码来源:cockpit.py

示例2: TkPictureFrame

# 需要导入模块: from Tkinter import Checkbutton [as 别名]
# 或者: from Tkinter.Checkbutton import config [as 别名]
class TkPictureFrame(Frame):
    def __init__(self, x, y, master=None):
        Frame.__init__(self, master)
        self.photo = None
        self.resolution = (x, y)
        #The center of the Canvas is 0, 0. Find the center so
        #we can draw the image properly.
        self.center = ( x/2, y/2)
        #Setup the canvas
        self.picture = Canvas(self, width=x, height=y)
        #Place the canvas in the Grid.
        self.picture.grid(row=0,column=0,columnspan=2)
        #Camera check button control.
        self.checkButton = Checkbutton(self, text='Camera?',\
            command=self.toggleCamera)
        #Place it on the grid.
        self.checkButton.grid(row=1,column=0)
        #Spinbox to set FPS
        self.fpsSpin = Spinbox(self, text="FPS", from_=2, to=30,\
            command=self.fpsSpinCallback)
        self.fpsSpin.grid(row=1, column=1)
        #Set framerate
        self.fpsSpinCallback()
        #To determine if the camera is running
        self.capturing = False

    def fpsSpinCallback(self):
        self.fps = int(self.fpsSpin.get())

    def changePic(self, photo):
        #Make a reference to the old photo for removal
        self.oldphoto = self.photo
        #Setup the new photo
        self.photo = photo
        #Draw the new photo over the old photo
        self.picture.create_image(self.center,image=self.photo)
        #Remove the old photo
        self.picture.delete(self.oldphoto)
        #Enable the checkbox
        self.checkButton.config(state="normal")


    def timedDisable(self, widget):
        #Disable a widget for 2 seconds.
        widget.config(state="disabled")
        time.sleep(2)
        widget.config(state="normal")

    def threadTimeDisable(self, widget):
        #Run the timed disable in a thread to avoid lockups.
        thread.start_new_thread(self.timedDisable, (widget,))

    def startCamera(self):
        #Disable the checkbox and fps spinner.
        self.checkButton.config(state="disabled")
        self.fpsSpin.config(state="disabled")
        #Start the camera
        thread.start_new_thread(self.setupCamera, self.resolution)
        self.capturing = True

    def stopCamera(self):
        #Disable the checkbox for a duration.
        self.threadTimeDisable(self.checkButton)
        #Enable the spinner.
        self.fpsSpin.config(state="normal")
        #Clear the canvas.
        self.capturing = False
        self.picture.delete("all")
        

    def toggleCamera(self):
        if self.capturing:
            self.stopCamera()    
        else:
            self.startCamera()

    def setupCamera(self, x, y):
        with picamera.PiCamera() as camera:
            camera.resolution = (x, y)
            camera.framerate = self.fps
            stream = io.BytesIO()
            for each in camera.capture_continuous(stream, format='jpeg'):
                # Truncate the stream to the current position (in case
                # prior iterations output a longer image)
                each.truncate()
                #Rewind the stream
                each.seek(0)
                #Open the image stream
                image = Image.open(each)
                photo = ImageTk.PhotoImage(image)
                #Break out of the loop if not capturing
                if not self.capturing:
                    break
                #Update the canvas
                self.changePic(photo)
                #Reset playback to the beginning for the next image.
                each.seek(0)
开发者ID:kewlsak,项目名称:Spoonapult,代码行数:99,代码来源:TkPictureFrame.py

示例3: __init__

# 需要导入模块: from Tkinter import Checkbutton [as 别名]
# 或者: from Tkinter.Checkbutton import config [as 别名]

#.........这里部分代码省略.........
		return self.checkComplete()

	def reportComplete(self):
		if self.reportOnly:
			return self.parameters
		
		if self.top != None:
			self.updateFlashDisplay()
			if self.readingFirmware:
				self.readingFirmware = False
				for s in FirmwareSettings:
					p = self.parameters[s]
					v = p.getFlash()
					p.setEEProm(v)
					self.settings.firmware[s] = v
				self.settings.setModified()
				self.updateEEPromDisplay()
			return None
		
		self.top = Toplevel(self.app)
		self.top.protocol('WM_DELETE_WINDOW', self.delTop)
		self.top.title("Firmware Parameters")
		
		gf = LabelFrame(self.top, text="")
		gf.grid(row=1, column=1, rowspan=len(grporder), padx=10, pady=10, sticky=N+S+E+W)
		
		l = Label(gf, text="Profiles:")
		l.grid(row=1, column=1, columnspan=2, pady=10)
		
		self.profList = Listbox(gf)
		self.profList.grid(row=2, column=1, columnspan=2, sticky=N+S+E+W)
		self.yScroll  =  Scrollbar (gf, orient=VERTICAL)
		self.yScroll.grid (row=2, column=3, sticky=N+S)
		self.profList.config(yscrollcommand=self.yScroll.set)
		self.yScroll.config(command=self.profList.yview)
		
		self.profList.bind('<ButtonRelease-1>', self.profSel)
	
		l = Label(gf, text=" ")
		l.grid(row=3, column=1, columnspan=2, pady=10)

		l = Label(gf, text="New Profile Name")
		l.grid(row=4, column=1, columnspan=2)
		self.newProf = Entry(gf, width=12)
		self.newProf.grid(row=5, column=1, columnspan=2)
		
		self.cbOWrite = IntVar()
		self.cbOverWrite = Checkbutton(gf, text="Over-Write",  variable=self.cbOWrite)
		self.cbOverWrite.grid(row=6, column=1, sticky=W)
		
		self.bSave = Button(gf, width=12, text="Save", command = self.doSave)
		self.bSave.grid(row=6, column=2)

		l = Label(gf, text=" ")
		l.grid(row=7, column=1, columnspan=2, pady=10)
		
		self.cbCDel = IntVar()
		self.cbConfirmDelete = Checkbutton(gf, text="Delete",  variable=self.cbCDel,	command=self.cbDoConfirmDelete, state=DISABLED)
		self.cbConfirmDelete.grid(row=8, column=1, sticky=W)
		
		self.bDel = Button(gf, width=12, text="Delete", command = self.doDelete, state=DISABLED)
		self.bDel.grid(row=8, column=2)
		
		gf = LabelFrame(self.top, text="")
		gf.grid(row=len(grporder)+1, column=1, sticky=N+S+E+W, padx=10)
		
开发者ID:jbernardis,项目名称:repraphost,代码行数:69,代码来源:firmware.py


注:本文中的Tkinter.Checkbutton.config方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。