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


Python Spinbox.config方法代码示例

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


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

示例1: ToolBar

# 需要导入模块: from Tkinter import Spinbox [as 别名]
# 或者: from Tkinter.Spinbox import config [as 别名]
class ToolBar(Frame):
	def __init__(self, root, printer, settings, logger, *arg):
		self.app = root
		self.printer = printer
		self.settings = settings
		self.logger = logger
		
		self.app.printing = False
		self.app.connected = False
		self.app.paused = False
		
		Frame.__init__(self, root, *arg)
		topBar = Frame(self)
		topBar.grid(row=1, column=1, columnspan=3, sticky=W)
		speedBar = Frame(self)
		speedBar.grid(row=1, column=5, sticky=E)
		bottomBar = Frame(self)
		bottomBar.grid(row=2, column=1, columnspan=6, sticky=W+E)
		
		self.bPort = Button(topBar, text="Port", width=BWIDTH, command=self.doPort)
		self.bPort.pack(side=LEFT, padx=2, pady=2)
		ports = self.scanSerial()
		self.spPort = Spinbox(topBar, values=ports, state="readonly")
		self.spPort.pack(side=LEFT, padx=2, pady=2)
		l = Label(topBar, text=" @ ")
		l.pack(side=LEFT, padx=2, pady=2)
		self.spBaud = Spinbox(topBar, values=baudChoices)
		self.spBaud.pack(side=LEFT, padx=2, pady=2)
		self.spBaud.delete(0, END)
		self.spBaud.insert(0, 115200)
		self.spBaud.config(state="readonly")

		self.bConnectMode = CM_CONNECT
		self.bConnect = Button(topBar, text=connectText[CM_CONNECT], width=BWIDTH, command=self.doConnect)
		self.bConnect.pack(side=LEFT, padx=2, pady=2)
		if len(ports) == 0:
			self.bConnect.config(state=DISABLED)
		else:
			self.bConnect.config(state=NORMAL)


		self.bReset = Button(topBar, text="Reset", width=BWIDTH, command=self.doReset, state=DISABLED)
		self.bReset.pack(side=LEFT, padx=2, pady=2)
		
		l = Label(speedBar, text="Speed:", justify=RIGHT)
		l.grid(row=1, column=1, sticky=E)

		self._speedJob = None		
		self.currentSpeed = self.app.FeedMultiply
		self.scSpeed = Scale(speedBar, from_=MINSPEED, to=MAXSPEED, orient=HORIZONTAL, command=self.updateSpeedCommand)
		self.scSpeed.grid(row=1, column=2)
		self.scSpeed.set(self.currentSpeed);

		l = Label(speedBar, text="Fan:", width=10, anchor=E, justify=RIGHT)
		l.grid(row=1, column=3, sticky=E)
		
		self._fanJob = None		
		self.currentFanSpeed = self.app.FanSpeed
		self.scFan = Scale(speedBar, from_=0, to=255, orient=HORIZONTAL, command=self.updateFanSpeedCommand)
		self.scFan.grid(row=1, column=4)
		self.scFan.set(self.currentFanSpeed);

		if self.settings.speedcommand is not None:
			self.cbvAssertFan = IntVar()
			if self.settings.forcefanspeed:
				self.cbvAssertFan.set(1)
			else:
				self.cbvAssertFan.set(0)
			self.cbAssertFan = Checkbutton(speedBar, text="Force", variable=self.cbvAssertFan,
				command=self.clickAssertFan)
			self.cbAssertFan.grid(row=1, column=5)

		self.bSliceMode = SM_SLICE
		self.bSlice = Button(bottomBar, text=sliceText[SM_SLICE], width=BWIDTH*2, command=self.doSlice)
		self.bSlice.pack(side=LEFT, padx=2, pady=2)
		
		self.bLoad = Button(bottomBar, text="Load GCode", width=BWIDTH, command=self.doLoad)
		self.bLoad.pack(side=LEFT, padx=2, pady=2)
		self.setSliceText()
		
		self.bSD = Button(bottomBar, text="SD", width=BWIDTH, command=self.doSD, state=DISABLED)
		self.bSD.pack(side=LEFT, padx=2, pady=2)
		
		self.bPrintMode = PR_PRINT		
		self.bPrint = Button(bottomBar, text=printText[PR_PRINT], width=BWIDTH, command=self.doPrint, state=DISABLED)
		self.bPrint.pack(side=LEFT, padx=2, pady=2)
		
		self.bPauseMode = PM_PAUSE
		self.bPause = Button(bottomBar, text=pauseText[PM_PAUSE], width=BWIDTH, command=self.doPause, state=DISABLED)
		self.bPause.pack(side=LEFT, padx=2, pady=2)

		self.bAbandon = Button(bottomBar, text="Abandon SD Print", width=BWIDTH+8, command=self.doAbandon, state=DISABLED)
		self.bAbandon.pack(side=LEFT, padx=2, pady=2)
		
		self.cbvLiftOnPause = IntVar()
		if self.settings.liftonpause:
			self.cbvLiftOnPause.set(1)
		else:
			self.cbvLiftOnPause.set(0)
		self.cbLiftOnPause = Checkbutton(bottomBar, text="Lift Head/Retract on Pause", variable=self.cbvLiftOnPause,
#.........这里部分代码省略.........
开发者ID:jbernardis,项目名称:repraphost,代码行数:103,代码来源:toolbar.py

示例2: JobParameters

# 需要导入模块: from Tkinter import Spinbox [as 别名]
# 或者: from Tkinter.Spinbox import config [as 别名]
class JobParameters(Toplevel):
    def __init__(self, parent=None, **kwargs):
        Toplevel.__init__(self, parent)
        self.title('Job Parameters')
        self.parent = parent
        self.main_frame = Frame(self)
        self.input_directory_gui = DirectorySelector(self.main_frame, 'Input Directory:')
        self.output_directory_gui = DirectorySelector(self.main_frame, 'Output Directory:', get_default=lambda: self.input_directory_gui.get_directory() + '/output/')
        self.input_directory_gui.set_notify(self.notify)
        self.beginning_year = kwargs['beginning_year'] if 'beginning_year' in kwargs else 1950
        self.ending_year = kwargs['ending_year'] if 'ending_year' in kwargs else 2100
        self.beginning_year_selector = YearSelector(self.main_frame, text="Beginning Year:", min_value=self.beginning_year, max_value=self.ending_year)
        self.ending_year_selector = YearSelector(self.main_frame, text="Ending Year:", min_value=self.beginning_year, max_value=self.ending_year)

        self.one_decade_range_var = IntVar()
        self.one_decade_range = Checkbutton(self.main_frame, text='Calculate 10 Year Range', variable=self.one_decade_range_var, command=self.on_change)
        self.two_decade_range_var = IntVar()
        self.two_decade_range = Checkbutton(self.main_frame, text='Calculate 20 Year Range', variable=self.two_decade_range_var, command=self.on_change)
        self.custom_range_var = IntVar()
        self.custom_range = Checkbutton(self.main_frame, text='Calculate Custom Year Range', variable=self.custom_range_var, command=self.on_change)
        self.custom_range_val = StringVar()
        self.custom_range_input = Spinbox(self.main_frame, from_=30, to=100, textvariable=self.custom_range_val, command=self.on_change, width=5)

        # Initialize widget values
        self.beginning_year_selector.set_value(self.beginning_year)
        self.beginning_year_selector.set_args(check_other_func=self.ending_year_selector.get_less_than)

        self.ending_year_selector.set_value(self.ending_year)
        self.ending_year_selector.set_args(check_other_func=self.beginning_year_selector.get_greater_than)

        self.one_decade_range_var.set(1)
        self.two_decade_range_var.set(1)
        self.custom_range_var.set(0)
        self.custom_range_input.config(state=Tkinter.DISABLED)

        self.button_frame = Frame(self.main_frame)
        self.ok_button = Button(self.button_frame, text='OK', command=self.on_submit)
        self.cancel_button = Button(self.button_frame, text='Cancel', command=self.on_close)
        self.job_id = kwargs['job_id'] if 'job_id' in kwargs else None
        self.entry = kwargs['entry'] if 'entry' in kwargs else None

        self.grab_set()

        self.resizable(width=False, height=False)

    def notify(self):
        self.output_directory_gui.notify()
        self.lift()

    def set_grid(self):
        # Layout child widgets
        self.main_frame.grid()

        self.input_directory_gui.set_grid(row=0, padx=6)
        self.output_directory_gui.set_grid(row=1, padx=6)

        self.beginning_year_selector.set_grid(row=2, padx=6)
        self.ending_year_selector.set_grid(row=3, padx=6)

        self.one_decade_range.grid(row=4, column=1, sticky='w', padx=6)
        self.two_decade_range.grid(row=5, column=1, sticky='w', padx=6)
        self.custom_range.grid(row=6, column=1, sticky='w', padx=6)
        self.custom_range_input.grid(row=6, column=2, sticky='w', padx=6)

        self.button_frame.grid(row=7, columnspan=3, sticky='nsew')
        self.ok_button.pack(side=Tkinter.RIGHT)
        self.cancel_button.pack(side=Tkinter.RIGHT)
        #self.ok_button.grid(row=7, column=1, pady=2)
        #self.cancel_button.grid(row=7, column=2, pady=2)

    def on_change(self):
        is_custom_range_checked = self.custom_range_var.get() == 1
        if is_custom_range_checked:
            self.custom_range_input.config(state=Tkinter.NORMAL)
        else:
            self.custom_range_input.config(state=Tkinter.DISABLED)

    def on_submit(self):
        if self.input_directory_gui.get_directory() == '' or self.output_directory_gui.get_directory() == '':
            self.on_close()
            return

        # The job parameters are extracted from the GUI here and passed to the processing thread to run the requisite job.
        job = dict()
        job['job_id'] = self.job_id
        job['delimiter'] = '.'
        job['individual_files'] = False
        job['input_directory'] = self.input_directory_gui.get_directory()
        job['output_directory'] = self.output_directory_gui.get_directory()
        job['start'] = self.beginning_year_selector.get_value()
        job['end'] = self.ending_year_selector.get_value()
        job['calculate_one_decade'] = self.one_decade_range_var.get() == 1
        job['calculate_two_decade'] = self.two_decade_range_var.get() == 1
        job['calculate_custom_range'] = self.custom_range_var.get() == 1
        job['custom_range'] = int(self.custom_range_val.get())
        job['log'] = True
        if self.entry != None:
            self.entry.add_job(job)
        self.on_close()

#.........这里部分代码省略.........
开发者ID:jhavstad,项目名称:model_runner,代码行数:103,代码来源:ModelRunnerGUI.py

示例3: TkPictureFrame

# 需要导入模块: from Tkinter import Spinbox [as 别名]
# 或者: from Tkinter.Spinbox 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

示例4: Temperatures

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

#.........这里部分代码省略.........
		return sorted(result, cmptemp)
		
	def doSetExt(self):
		if self.app.printerAvailable(cmd="M104"):
			if self.settings.fanwithextruder and self.app.FanSpeed != 255:
				if self.settings.forcefanspeed:
					self.logger.logMsg("Asserting fan speed of %d" % self.app.FanSpeed)
				else:
					self.app.toolbar.setFanSpeed(255)
			temp = self.spExtTemp.get().split(' ')[0]
			self.printer.send_now("M104 S%s" % temp)
			self.app.exttarget = float(temp)
		
	def valExtTemp(self, *arg):
		invalid = False
		try:
			choice = self.spExtTemp.get()
			x = int(choice.split(' ')[0])
		except:
			self.log.logMsg("Value for Extruder temperature not a valid integer")
			invalid = True
		else:
			if x <=0 or x >MAXEXTTEMP:
				self.log.logMsg("Value for Extruder temperature out of range(0-%d" % MAXEXTTEMP)
				invalid = True
			
		if invalid:
			self.spExtTemp.delete(0, END)
			self.spExtTemp.insert(0, "%s" % self.formatTemps(self.settings.extemps)[0])
		else:
			if choice not in self.settings.extemps:
				self.settings.extemps.append(choice)
				self.settings.setModified()
				self.spExtTemp.config(values=self.formatTemps(self.settings.extemps))
				self.spExtTemp.delete(0, END)
				self.spExtTemp.insert(0, choice)
				
			if self.settings.lastexttemp != choice:
				self.settings.lastexttemp = choice
				self.settings.setModified()

		return True
		
	def doOffExt(self, *arg):
		if self.app.printerAvailable(cmd="M104"):
			if self.settings.fanwithextruder and self.app.FanSpeed != 0:
				if self.settings.forcefanspeed:
					self.logger.logMsg("Asserting fan speed of %d" % self.app.FanSpeed)
				else:
					self.app.toolbar.setFanSpeed(0)
			self.printer.send_now("M104 S0")

	def drawExtAxes(self):
		self.canvasExt.delete("AXES")
		for i in range(0, MAXEXTTEMP, 50):
			y = 100.0-(float(i)/MAXEXTTEMP*100.0)
			self.canvasExt.create_line(0, y, 200, y, fill="#C0C0C0", tags="AXES")
			self.legendExt.create_text(LEGEND_WIDTH, y+7, anchor=SE, tags="AXES", text="%3d" % i)
	
	def addExtDatapoint(self, t):
		c = (t/MAXEXTTEMP)*100.0
		self.dataExt.append(c)
		while len(self.dataExt) >= MAXDATAPOINTS:
			del(self.dataExt[0])
			
		self.canvasExt.delete("TARGET")
开发者ID:jbernardis,项目名称:repraphost,代码行数:70,代码来源:temps.py

示例5: MacroEdit

# 需要导入模块: from Tkinter import Spinbox [as 别名]
# 或者: from Tkinter.Spinbox import config [as 别名]
class MacroEdit(Toplevel):
	def __init__(self, root, prtr, settings, log, fn, text, *arg):
		Toplevel.__init__(self, root, *arg)
		self.title("Macro Editor")
		
		self.fn = fn
		
		self.app = root
		self.settings = settings
		self.printer = prtr
		self.log = log
		
		self.macroList = self.settings.getMacroList()
		self.macroEntry = None
		
		if fn == None:
			title = "New macro"
			self.macroTitle = None
			self.newMacro = True
		else:
			self.newMacro = False
			self.macroTitle = title = os.path.basename(fn)
			for m in self.macroList:
				if self.macroTitle == m[MNAME]:
					self.macroEntry = m
					break
		
		self.f = LabelFrame(self, text=title)
		
		self.entry = Text(self.f, width=80, height=24, relief=RIDGE, bd=2)
		self.entry.grid(row=1, column=1)
		
		self.f.grid(row=1, column=1, columnspan=6)
		
		self.bSave = Button(self, text="Save", width=20, command=self.doSave)
		self.bSave.grid(row=2, column=1)
		self.bExit = Button(self, text="Exit", width=20, command=self.doExit)
		self.bExit.grid(row=2, column=2)
		
		self.cbvAddButton = IntVar()
		self.cbAddButton = Checkbutton(self, text="Add Button",  variable=self.cbvAddButton, command=self.doAddButton)
		self.cbAddButton.grid(row=2, column=3)
		
		self.buttonText = Entry(self, width=12)
		self.buttonText.grid(row=2, column=4)

		l = Label(self, text="Column:", justify=RIGHT)
		l.grid(row=2, column=5, sticky=E)
		self.spCol = Spinbox(self, values=[1,2,3], width=12, justify=RIGHT)
		self.spCol.grid(row=2, column=6)

		l = Label(self, text="Row:", justify=RIGHT)
		l.grid(row=3, column=5, sticky=E)
		self.spRow = Spinbox(self, values=[1,2,3,4,5,6,7,8,9,10], width=12, justify=RIGHT)
		self.spRow.grid(row=3, column=6)

		if self.macroEntry != None:
			self.cbvAddButton.set(1)
			self.spRow.delete(0, END)
			self.spRow.insert(0, self.macroEntry[MROW])
			self.spCol.delete(0, END)
			self.spCol.insert(0, self.macroEntry[MCOL])
			self.buttonText.delete(0, END)
			self.buttonText.insert(0, self.macroEntry[MTEXT])
			self.initialButtonInfo = [1, self.macroEntry[MCOL], self.macroEntry[MROW], self.macroEntry[MTEXT]]
		else:		
			self.cbvAddButton.set(0)
			self.spRow.delete(0, END)
			self.spRow.insert(0, 1)
			self.spCol.delete(0, END)
			self.spCol.insert(0, 1)
			self.buttonText.delete(0, END)
			self.initialButtonInfo = [0, 1, 1, ""]
			
		self.doAddButton()

		self.startText = text
		self.entry.delete("1.0", END)
		self.entry.insert(END, self.startText)
		self.entry.edit_modified(False)
		
		self.grab_set()
		self.app.wait_window(self)
	
	def doAddButton(self):
		if self.cbvAddButton.get() == 1:
			self.buttonText.config(state=NORMAL)
			self.spRow.config(state=NORMAL)
			self.spCol.config(state=NORMAL)
		else:
			self.buttonText.config(state=DISABLED)
			self.spRow.config(state=DISABLED)
			self.spCol.config(state=DISABLED)
			
	def buttonInfoChanged(self):
		if self.cbvAddButton.get() != self.initialButtonInfo[0]:
			return True
		
		if self.initialButtonInfo[1] != int(self.spCol.get()):
			return True
#.........这里部分代码省略.........
开发者ID:jbernardis,项目名称:repraphost,代码行数:103,代码来源:macroedit.py

示例6: Cockpit

# 需要导入模块: from Tkinter import Spinbox [as 别名]
# 或者: from Tkinter.Spinbox 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(1, 1, 400, 400, outline="#ff0000")
        self._shiftCanvas.create_line(200, 2, 200, 400, fill="#ff0000")
        self._shiftCanvas.create_line(2, 200, 400, 200, fill="#ff0000")
        self._shiftMarker = self._shiftCanvas.create_oval(196, 196, 204, 204, 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=10000.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=10000.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=10000.0, increment=0.01, state=DISABLED, \
                                         textvariable=self._pidDString, command=self._onPidSpinboxChanged)
        self._pidDSpinbox.pack(side=LEFT, padx=2)
        
开发者ID:dpm76,项目名称:eaglebone,代码行数:69,代码来源:cockpit.py

示例7: Cockpit

# 需要导入模块: from Tkinter import Spinbox [as 别名]
# 或者: from Tkinter.Spinbox 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


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