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


Python Spinbox.delete方法代码示例

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


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

示例1: create_entry

# 需要导入模块: from Tkinter import Spinbox [as 别名]
# 或者: from Tkinter.Spinbox import delete [as 别名]
 def create_entry(self, cadence=None):
     if cadence is None:
         if len(self.cadences) > 0:
             cadence = int(self.cadences[-1].get()) + 10
         else:
             cadence = 40
     cadenceent = Spinbox(from_=10, to=180, width=3, master=self)
     cadenceent.delete(0, END)
     cadenceent.insert(0, cadence)
     self.cadences.append(cadenceent)
开发者ID:WillBickerstaff,项目名称:pycycle,代码行数:12,代码来源:outputopts.py

示例2: ToolBar

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

示例3: MoveControl

# 需要导入模块: from Tkinter import Spinbox [as 别名]
# 或者: from Tkinter.Spinbox import delete [as 别名]
class MoveControl(LabelFrame):
	def __init__(self, root, prtr, settings, log, *arg):
		fn = os.path.join(settings.cmdFolder, "images", "control_xyz.png")
		self.image = Image.open(fn)
		self.photo = ImageTk.PhotoImage(self.image)
		LabelFrame.__init__(self, root, *arg, text="Movement")

		self.app = root
		self.hilite = None
		self.hilitemask = None
		self.settings = settings
		self.printer = prtr
		self.log = log
		
		l = Label(self, text="mm/min")
		l.grid(row=1, column=2)
		
		l = Label(self, text="X/Y Feed Rate:")
		l.grid(row=2, column=1, sticky=E)
		
		self.xyfeed = Spinbox(self, width=10, justify=RIGHT, from_=0, to=MAXFEED)
		self.xyfeed.grid(row=2, column=2)
		self.xyfeed.delete(0, END)
		self.xyfeed.insert(0, settings.xyfeed)
		self.xyfeed.bind("<FocusOut>", self.valxyFeed)
		self.xyfeed.bind("<Leave>", self.valxyFeed)
		
		l = Label(self, text="Z Feed Rate:")
		l.grid(row=3, column=1, sticky=E)
				
		self.zfeed = Spinbox(self, width=10, justify=RIGHT, from_=0, to=MAXFEED)
		self.zfeed.grid(row=3, column=2)
		self.zfeed.delete(0, END)
		self.zfeed.insert(0, settings.zfeed)
		self.zfeed.bind("<FocusOut>", self.valzFeed)
		self.zfeed.bind("<Leave>", self.valzFeed)
		
		self.canvas = Canvas(self, width=self.image.size[0], height=self.image.size[1], *arg)
		self.canvas.create_image((0, 0), image=self.photo, anchor=N+W)
		self.canvas.grid(row=4, column=1, columnspan=2)
		for m in imageMasks:
			self.canvas.create_oval((m[0][0]-mask_rad, m[0][1]-mask_rad, m[0][0]+mask_rad, m[0][1]+mask_rad),
							outline="#FF0000", width=4, tags=m[1], state=HIDDEN)
		self.canvas.bind("<Button-1>", self.OnLeftDown)
		self.canvas.bind("<Motion>", self.OnMotion)
		self.canvas.bind("<Enter>", self.OnEnter)
		self.canvas.bind("<Leave>", self.OnLeave)
		
		self.bAllOff = Button(self, text="Release Motors", command=self.allMotorsOff)	
		self.bAllOff.grid(row=5, column=1, columnspan=2)
		
	def valxyFeed(self, *arg):
		x = self.validFeed(self.xyfeed.get(), 'XY')
			
		if x == None:
			self.xyfeed.delete(0, END)
			self.xyfeed.insert(0, "%d" % self.settings.xyfeed)
			return True

		if self.settings.xyfeed != x:
			self.settings.xyfeed = x
			self.settings.setModified()		
		return True
		
	def valzFeed(self, *arg):
		x = self.validFeed(self.zfeed.get(), 'Z')
			
		if x == None:
			self.zfeed.delete(0, END)
			self.zfeed.insert(0, "%d" % self.settings.zfeed)
			return True

		if self.settings.zfeed != x:
			self.settings.zfeed = x
			self.settings.setModified()		
		return True
	
	def validFeed(self, fv, axis):
		try:
			x = int(fv)
		except:
			self.log.logMsg("Value for %s feed rate not a valid integer" % axis)
			return None

		if x <=0 or x >MAXFEED:
			self.log.logMsg("Value for %s feed rate out of range(0-5000)" % axis)
			return None
		
		return x
	
	def allMotorsOff(self):
		if self.app.printerAvailable(cmd="M84"):
			self.printer.send_now("M84")	

	def OnMotion(self, e):
		for i in range(len(imageGeometry)):
			if boundBy((e.x, e.y), imageGeometry[i][0]):
				self.setHilite(i)
				return
		if self.hilite != None:
#.........这里部分代码省略.........
开发者ID:jbernardis,项目名称:repraphost,代码行数:103,代码来源:movecontrol.py

示例4: SettingWindow

# 需要导入模块: from Tkinter import Spinbox [as 别名]
# 或者: from Tkinter.Spinbox import delete [as 别名]
class SettingWindow(Toplevel):
    def __init__(self, master, max_num_features, num_frames, mser_image):
        Toplevel.__init__(self, master)

        self.protocol('WM_DELETE_WINDOW', self.withdraw)

        self.notebook = ttk.Notebook(self)
        frame_feats = ttk.Frame(self.notebook)
        frame_forest = ttk.Frame(self.notebook)
        frame_mser = ttk.Frame(self.notebook)
        frame_other = ttk.Frame(self.notebook)
        self.notebook.add(frame_feats, text="Features ")
        self.notebook.add(frame_forest, text=" Forest  ")
        self.notebook.add(frame_mser, text=" MSER  ")
        self.notebook.add(frame_other, text=" Other  ")

        self.max_num_feats = max_num_features
        self.selection = None

        self.mser_image = mser_image

        rand_row = random.randint(1, 512-200)
        rand_col = random.randint(1, 512-110)
        self.mser_area = mser_image[rand_row:rand_row+180, rand_col:rand_col+100]

        # read images from icons folder
        self.hf0_img = PhotoImage(file="./icons/hf0.gif")
        self.hf1_img = PhotoImage(file="./icons/hf1.gif")
        self.hf2_img = PhotoImage(file="./icons/hf2.gif")
        self.hf3_img = PhotoImage(file="./icons/hf3.gif")
        self.hf4_img = PhotoImage(file="./icons/hf4.gif")
        self.hf5_img = PhotoImage(file="./icons/hf5.gif")

        self.features_vars = list()
        for i in range(max_num_features):
            self.features_vars.append(IntVar())

        Label(frame_feats, text="Patch size (" + u"\N{GREEK SMALL LETTER PI}" + "):").grid(row=0, column=0, pady=5)
        self.patch_size_spinbox = Spinbox(frame_feats, from_=3, to=30, width=3)
        self.patch_size_spinbox.delete(0, END)
        self.patch_size_spinbox.insert(END, 10)
        self.patch_size_spinbox.grid(row=0, column=1, padx=5)

        f1 = ttk.Labelframe(frame_feats, text='Mean filter')
        f1.grid(row=1, columnspan=2)

        Label(f1, text=u"\N{GREEK SMALL LETTER PI}").grid(row=0, column=0)
        Checkbutton(f1, text="R", variable=self.features_vars[0]).grid(row=0, column=1)
        Checkbutton(f1, text="G", variable=self.features_vars[1]).grid(row=0, column=2)
        Checkbutton(f1, text="B", variable=self.features_vars[2]).grid(row=0, column=3)

        Label(f1, text=u"\N{GREEK SMALL LETTER PI}" + "/2").grid(row=1, column=0)
        Checkbutton(f1, text="R", variable=self.features_vars[3]).grid(row=1, column=1)
        Checkbutton(f1, text="G", variable=self.features_vars[4]).grid(row=1, column=2)
        Checkbutton(f1, text="B", variable=self.features_vars[5]).grid(row=1, column=3)

        f2 = ttk.Labelframe(frame_feats, text="Gaussian filter")
        f2.grid(row=2, columnspan=2)

        Label(f2, text=str(1.0)).grid(row=0, column=0)
        Checkbutton(f2, text="R", variable=self.features_vars[6]).grid(row=0, column=1)
        Checkbutton(f2, text="G", variable=self.features_vars[7]).grid(row=0, column=2)
        Checkbutton(f2, text="B", variable=self.features_vars[8]).grid(row=0, column=3)

        Label(f2, text=str(3.5)).grid(row=1, column=0)
        Checkbutton(f2, text="R", variable=self.features_vars[9]).grid(row=1, column=1)
        Checkbutton(f2, text="G", variable=self.features_vars[10]).grid(row=1, column=2)
        Checkbutton(f2, text="B", variable=self.features_vars[11]).grid(row=1, column=3)

        f3 = ttk.Labelframe(frame_feats, text="Laplacian of gaussian")
        f3.grid(row=3, columnspan=2)

        Label(f3, text=str(2.0)).grid(row=0, column=0)
        Checkbutton(f3, text="R", variable=self.features_vars[12]).grid(row=0, column=1)
        Checkbutton(f3, text="G", variable=self.features_vars[13]).grid(row=0, column=2)
        Checkbutton(f3, text="B", variable=self.features_vars[14]).grid(row=0, column=3)

        Label(f3, text=str(3.5)).grid(row=1, column=0)
        Checkbutton(f3, text="R", variable=self.features_vars[15]).grid(row=1, column=1)
        Checkbutton(f3, text="G", variable=self.features_vars[16]).grid(row=1, column=2)
        Checkbutton(f3, text="B", variable=self.features_vars[17]).grid(row=1, column=3)

        f4 = ttk.Labelframe(frame_feats, text="Haar-like features")
        f4.grid(row=1, rowspan=2, column=3, padx=5)

        Checkbutton(f4, image=self.hf0_img, variable=self.features_vars[18]).grid(row=0, column=0)
        Checkbutton(f4, image=self.hf1_img, variable=self.features_vars[19]).grid(row=0, column=1)
        Checkbutton(f4, image=self.hf2_img, variable=self.features_vars[20]).grid(row=1, column=0)
        Checkbutton(f4, image=self.hf3_img, variable=self.features_vars[21]).grid(row=1, column=1)
        Checkbutton(f4, image=self.hf4_img, variable=self.features_vars[22]).grid(row=2, column=0)
        Checkbutton(f4, image=self.hf5_img, variable=self.features_vars[23]).grid(row=2, column=1)

        buttons_paned_window = PanedWindow(frame_feats, orient=VERTICAL)
        buttons_paned_window.grid(row=3, column=3)

        self.select_all_button = Button(buttons_paned_window, text="Select all", command=self._select_all)
        buttons_paned_window.add(self.select_all_button)

        self.clear_selection_button = Button(buttons_paned_window, text="Clear selection", command=self._clear_selection)
        buttons_paned_window.add(self.clear_selection_button)
#.........这里部分代码省略.........
开发者ID:jhowarth15,项目名称:celldetector,代码行数:103,代码来源:SettingWindow.py

示例5: Application

# 需要导入模块: from Tkinter import Spinbox [as 别名]
# 或者: from Tkinter.Spinbox import delete [as 别名]
class Application(Frame):
    MAXWORDLEN = 20
    DEFAULTWORDLEN = 3
    MANDATORY1stCHAR=0

    def __init__(self, master=None):
        Frame.__init__(self, master, padx=3, pady=3)
        self.dictionaryfile = None
        self.menubar = Menu()
        self.__createWidgets()
        self.menubar.add_cascade(label='File', menu=self.__File)
        self.menubar.add_cascade(label='Options', menu=self.__Options)
        self.menubar.add_command(label='About', command=self.__about)
        self.__params.grid(row=0, column=0, sticky=W)
        self.__res_pane = Frame()
        self.__res_pane.grid(row=2, column=0, sticky=E + W)
        self.__status = Label(anchor=W, relief=SUNKEN)
        self.__status.grid(row=3, column=0, sticky=E + W)
        self.osDictFile()
        self.matchobj = None
        if self.dictionaryfile is None:
            self.status('No dictionary defined!')
        master.config(menu=self.menubar)

    def __createWidgets(self):
        self.__params = Frame(padx=5, pady=5)
        Label(text='Letters: ', anchor=E).grid(row=0, column=0,
                                               sticky=E, in_=self.__params)
        self.__char_entry = Entry(width=10)
        self.__chk1st = Checkbutton(variable=self.MANDATORY1stCHAR, command=self.__CB)
        Label(text='First letter appears in every result ', anchor=W).grid(
            row=0, column=4, sticky=E, in_=self.__params)
        self.__char_entry.grid(row=0, column=1, columnspan=2,
                               sticky=W, in_=self.__params)
        self.__chk1st.grid(row=0, column=3, sticky=W, in_=self.__params)
        Label(text='Minimum length of result words: ', anchor=E).grid(
            row=1, column=0, sticky=E, in_=self.__params)
        self.__word_length_ctrl = Spinbox(from_=1, to=Application.MAXWORDLEN,
                                          width=2)
        self.__word_length_ctrl.delete(0, END)
        self.__word_length_ctrl.insert(0, Application. DEFAULTWORDLEN)
        self.__word_length_ctrl.grid(row=1, column=1, in_=self.__params,
                                     sticky=W)
        self.__go_button = Button(text='Go', command=self.__findWords)
        self.__go_button.grid(row=1, column=2, sticky=E, in_=self.__params)
        self.__Options = Menu()
        self.__Options.add_command(label='Choose dictionary',
                                           command=self.__choosedict)
        self.__File = Menu()
        self.__File.add_command(label='Export as ODT (Open document text)', command=self.__export)
        self.__char_entry.focus_set()
        self.__char_entry.bind("<Return>", self.__keyPressEnter)

    def __CB(self):
        self.MANDATORY1stCHAR = not self.MANDATORY1stCHAR

    def __choosedict(self):
        try:
            self.dictionaryfile = tkFileDialog.askopenfile(mode='r').name
            self.status('')
        except AttributeError:
            pass

    def osDictFile(self):
        if 'linux' in sys.platform:
            self.dictionaryfile = '/usr/share/dict/words'

    def __about(self):
        AboutDialog(self)

    def status(self, text):
        self.__status.config(text=text)
        self.__status.update_idletasks()

    def __findWords(self):
        self.__res_pane.grid_forget()
        chars = self.__char_entry.get()
        minlen = int(self.__word_length_ctrl.get())
        if len(chars) < minlen:
            tkMessageBox.showerror(title='Not enough letters',
                        message='''Not enough letters given\n
You must give at least as many letters as the minimum required word length''')
            return
        res = self.__getres(minlen, chars)
        self.__res_pane = ResultPane(res)
        self.__res_pane.grid(row=2, column=0, sticky=E + W)

    def __getres(self, minlen, chars):
        firstpass = True
        while True:
            try:
                self.matchobj = None
                if firstpass and self.dictionaryfile is None:
                    self.matchobj = Match(minlen=minlen, chars=chars,
                                      statushandler=self.status, mand1st=self.MANDATORY1stCHAR)
                    firstpass = False
                else:
                    self.matchobj = Match(minlen=minlen, chars=chars,
                                     dict=self.dictionaryfile,
                                     statushandler=self.status, mand1st=self.MANDATORY1stCHAR)
#.........这里部分代码省略.........
开发者ID:WillBickerstaff,项目名称:sundial,代码行数:103,代码来源:app.py

示例6: Extruder

# 需要导入模块: from Tkinter import Spinbox [as 别名]
# 或者: from Tkinter.Spinbox import delete [as 别名]
class Extruder(LabelFrame):
	def __init__(self, root, prtr, settings, log, *arg):
		LabelFrame.__init__(self, root, *arg, text="Extruder")
		self.app = root
		self.printer = prtr
		self.settings = settings
		self.log = log

		self.bExtrude = Button(self, text="Extrude", width=10, command=self.doExtrude)
		self.bExtrude.grid(row=1, column=1, padx=2)
		
		self.spDistance = Spinbox(self, from_=1, to=MAXDIST, width=6, justify=RIGHT)
		self.spDistance.grid(row=1, column=2)
		self.spDistance.delete(0, END)
		self.spDistance.insert(0, STARTDIST)
		self.spDistance.bind("<FocusOut>", self.valDistance)
		self.spDistance.bind("<Leave>", self.valDistance)

		l = Label(self, text="mm", justify=LEFT)
		l.grid(row=1, column=3, sticky=W)

		self.bReverse = Button(self, text="Reverse", width=10, command=self.doReverse)
		self.bReverse.grid(row=2, column=1, padx=2)
		
		self.spSpeed = Spinbox(self, from_=1, to=MAXFEED, width=6, justify=RIGHT)
		self.spSpeed.grid(row=2, column=2)
		self.spSpeed.delete(0, END)
		self.spSpeed.insert(0, self.settings.efeed)
		self.spSpeed.bind("<FocusOut>", self.valSpeed)
		self.spSpeed.bind("<Leave>", self.valSpeed)

		l = Label(self, text="mm/min", justify=LEFT)
		l.grid(row=2, column=3, sticky=W)
		
	def valDistance(self, *arg):
		invalid = False
		try:
			y = float(self.spDistance.get())
		except:
			self.log.logMsg("Value for distance not a valid number")
			invalid = True
		else:
			if y <=0 or y >MAXDIST:
				self.log.logMsg("Value for Distance out of range (0-%d)" % MAXDIST)
				invalid = True
			
		if invalid:
			self.spDistance.delete(0, END)
			self.spDistance.insert(0, STARTDIST)

		return True
	
	def valSpeed(self, *arg):
		invalid = False
		try:
			x = int(self.spSpeed.get())
		except:
			self.log.logMsg("Value for E feed rate not a valid integer")
			invalid = True
		else:
			if x <=0 or x >MAXFEED:
				self.log.logMsg("Value for E feed rate out of range(0-%d)" % MAXFEED)
				invalid = True
			
		if invalid:
			self.spSpeed.delete(0, END)
			self.spSpeed.insert(0, "%d" % self.settings.efeed)
		else:
			if self.settings.efeed != x:
				self.settings.efeed = x
				self.settings.setModified()		
		return True
	
	def doExtrude(self):
		if self.app.printerAvailable(cmd="G91"):
			dist = self.spDistance.get()
			self.printer.send_now("G91")
			self.printer.send_now("G1 E%s F%s" % (dist, self.settings.efeed))
			self.printer.send_now("G90")
	
	def doReverse(self):
		if self.app.printerAvailable(cmd="G91"):
			dist = self.spDistance.get()
			self.printer.send_now("G91")
			self.printer.send_now("G1 E-%s F%s" % (dist, self.settings.efeed))
			self.printer.send_now("G90")
开发者ID:jbernardis,项目名称:repraphost,代码行数:88,代码来源:extruder.py

示例7: main

# 需要导入模块: from Tkinter import Spinbox [as 别名]
# 或者: from Tkinter.Spinbox import delete [as 别名]
def main():
    root = Tk()

    root.title("Day Calculator")

    Birthdate = Label(root, text="Birth Day").grid(row=0, column=0)
    Today = Label(root, text="Today").grid(row=0, column=2)
    monthLabel = Label(root, text="Month(MM)").grid(row=1, column=1)
    dayLabel = Label(root, text="Day(DD)").grid(row=2, column=1)
    yearLabel = Label(root, text="Year(YYYY)").grid(row=3, column=1)

    # want to make a switch thingy
    # is a spinbox, but still funky though.

    # the birth info
    birthMonth = Spinbox(root, from_=1, to=12, bd=5)
    birthDay = Spinbox(root, from_=1, to=31, bd=5)
    birthYear = Spinbox(root, from_=1900, to=3000, bd=5)
    birthMonth.delete(0, END)
    birthMonth.insert(10, 12)
    birthDay.delete(0, END)
    birthDay.insert(10, 5)
    birthYear.delete(0, END)
    birthYear.insert(10, 1994)

    # today info
    todayMonth = Spinbox(root, from_=1, to=12, bd=5)
    todayDay = Spinbox(root, from_=1, to=31, bd=5)
    todayYear = Spinbox(root, from_=1900, to=3000, bd=5)
    today = getTodayInfo()
    todayMonth.delete(0, END)
    todayMonth.insert(10, today[0])
    todayDay.delete(0, END)
    todayDay.insert(10, today[1])
    todayYear.delete(0, END)
    todayYear.insert(10, today[2])

    # grid it!
    birthMonth.grid(row=1, column=0)
    birthDay.grid(row=2, column=0)
    birthYear.grid(row=3, column=0)
    todayMonth.grid(row=1, column=2)
    todayDay.grid(row=2, column=2)
    todayYear.grid(row=3, column=2)

    text = Entry(root, bd=5)
    text.insert(END, "Press Submit")
    text.grid(row=4, column=2)

    # functions
    def calculate():
        text.delete(0, END)
        days = differenceManual(
            int(birthMonth.get()),
            int(birthDay.get()),
            int(birthYear.get()),
            int(todayMonth.get()),
            int(todayDay.get()),
            int(todayYear.get())
        )
        if days == -1:
            string = "Incorrect Date"
        else:
            string = str(days) + " Days Old!"
        text.insert(END, string)

    submit = Button(root, text="Submit", command=calculate)
    quit = Button(root, text='Quit', command=root.quit)
    submit.grid(row=4, column=1)
    quit.grid(row=4, column=0)

    # run!!!
    root.mainloop()
开发者ID:iamanogre,项目名称:DayCalculator,代码行数:75,代码来源:dayCalcGUI.py

示例8: Temperatures

# 需要导入模块: from Tkinter import Spinbox [as 别名]
# 或者: from Tkinter.Spinbox import delete [as 别名]
class Temperatures(LabelFrame):
	def __init__(self, root, prtr, settings, log, *arg):
		LabelFrame.__init__(self, root, *arg, text="Temperatures")
		self.app = root
		self.printer = prtr
		self.settings = settings
		self.log = log

		l = Label(self, text="Extruder:", justify=LEFT)
		l.grid(row=1, column=1, sticky=W)
		
		self.statExt = Canvas(self, width=150, height=STAT_HEIGHT, bd=2, bg="white", relief=RIDGE)
		self.statExt.grid(row=1, column=2, columnspan=2)
		self.setStatus(self.statExt, UNKNOWN)
		
		self.bSetExt = Button(self, text="Set", width=4, command=self.doSetExt)
		self.bSetExt.grid(row=2, column=1, padx=2)
		
		self.spExtTemp = Spinbox(self, values=self.formatTemps(self.settings.extemps), width=12, justify=RIGHT)
		self.spExtTemp.grid(row=2, column=2)
		if self.settings.lastexttemp != None:
			self.spExtTemp.delete(0, END)
			self.spExtTemp.insert(0, self.settings.lastexttemp)
		self.spExtTemp.bind("<FocusOut>", self.valExtTemp)
		self.spExtTemp.bind("<Leave>", self.valExtTemp)

		self.bOffExt = Button(self, text="Off", width=4, command=self.doOffExt)
		self.bOffExt.grid(row=2, column=3, padx=2)
		
		self.frameExt = Frame(self)
		self.frameExt.grid(row=3, column=1, columnspan=3)
		
		self.legendExt = Canvas(self.frameExt, width=LEGEND_WIDTH, height=100, bd=2, bg="white", relief=RIDGE)
		self.legendExt.pack(side=LEFT, padx=0, pady=2)
		
		self.canvasExt = Canvas(self.frameExt, width=200, height=100, bd=2, bg="white", relief=RIDGE)
		self.canvasExt.pack(side=LEFT, padx=0, pady=2)
		self.drawExtAxes()
		
		self.extFan = IntVar()
		if self.settings.fanwithextruder:
			self.extFan.set(1)
		else:
			self.extFan.set(0)
			
		self.cb = Checkbutton(self, text="Fan on with extruder", variable=self.extFan, command=self.fanCheck)
		self.cb.grid(row=4, column=1, columnspan=3)

		self.forceExtTemp = IntVar()
		if self.settings.forceexttemp:
			self.forceExtTemp.set(1)
		else:
			self.forceExtTemp.set(0)
		self.forceExtTempCheck()
		self.bForceExt = Checkbutton(self, text="Force Ext Temp", variable=self.forceExtTemp, command=self.forceExtTempCheck)
		self.bForceExt.grid(row=5, column=1, columnspan=3)

		l = Label(self, text="Bed:", justify=LEFT)
		l.grid(row=6, column=1, sticky=W)

		self.statBed = Canvas(self, width=150, height=STAT_HEIGHT, bd=2, bg="white", relief=RIDGE)
		self.statBed.grid(row=6, column=2, columnspan=2)
		self.setStatus(self.statBed, UNKNOWN)

		self.bSetBed = Button(self, text="Set", width=4, command=self.doSetBed)
		self.bSetBed.grid(row=7, column=1, padx=2)
		
		self.spBedTemp = Spinbox(self, values=self.formatTemps(self.settings.bedtemps), width=12, justify=RIGHT)
		self.spBedTemp.grid(row=7, column=2)
		if self.settings.lastbedtemp != None:
			self.spBedTemp.delete(0, END)
			self.spBedTemp.insert(0, self.settings.lastbedtemp)
		self.spBedTemp.bind("<FocusOut>", self.valBedTemp)
		self.spBedTemp.bind("<Leave>", self.valBedTemp)
		
		self.bOffBed = Button(self, text="Off", width=4, command=self.doOffBed)
		self.bOffBed.grid(row=7, column=3, padx=2)
		
		self.frameBed = Frame(self)
		self.frameBed.grid(row=8, column=1, columnspan=3)
		
		self.legendBed = Canvas(self.frameBed, width=LEGEND_WIDTH, height=100, bd=2, bg="white", relief=RIDGE)
		self.legendBed.pack(side=LEFT, padx=0, pady=2)
		
		self.canvasBed = Canvas(self.frameBed, width=200, height=100, bd=2, bg="white", relief=RIDGE)
		self.canvasBed.pack(side=LEFT, padx=0, pady=2)
		self.drawBedAxes()
		
		self.dataBed = []
		self.dataExt = []
		
		self.forceBedTemp = IntVar()
		if self.settings.forcebedtemp:
			self.forceBedTemp.set(1)
		else:
			self.forceBedTemp.set(0)
		self.forceBedTempCheck()
		self.bForceBed = Checkbutton(self, text="Force Bed Temp", variable=self.forceBedTemp, command=self.forceBedTempCheck)
		self.bForceBed.grid(row=9, column=1, columnspan=3)
		
#.........这里部分代码省略.........
开发者ID:jbernardis,项目名称:repraphost,代码行数:103,代码来源:temps.py

示例9: MacroEdit

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

示例10: ScanDialog

# 需要导入模块: from Tkinter import Spinbox [as 别名]
# 或者: from Tkinter.Spinbox import delete [as 别名]
class ScanDialog(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.worker = None
        self.elapsed = 0
        self.settings = Settings(self)

        # self.initUI() follows

        self.parent.title("Scan Images")
        self.pack(fill=BOTH, expand=1)

        r = 0  # current grid row

        Label(self, text="Name prefix:").grid(row=r, column=0)
        Label(self, text="Number suffix:").grid(row=r, column=1)
        r += 1

        self.newName = StringVar()
        self.newName.set('Scan_')
        newName = Entry(self, textvariable=self.newName, width=60)
        newName.grid(row=1, column=0)
        newName.bind("<Return>",   lambda event: self.scan())
        newName.bind("<KP_Enter>", lambda event: self.scan())
        newName.bind("<Escape>", lambda event: self.parent.destroy())
        newName.focus_set()
        self.newNameEntry = newName

        self.numberSuffix = Spinbox(self, from_=1, to=999)
        self.numberSuffix.bind("<Return>",   lambda event: self.scan())
        self.numberSuffix.bind("<KP_Enter>", lambda event: self.scan())
        self.numberSuffix.grid(row=r, column=1)
        r += 1

        self.okButton = Button(self, text="Scan", command=self.scan, width=60, height=5)
        self.okButton.grid(row=r, column=0)

        cancelButton = Button(self, text="Cancel", command=self.parent.destroy)
        cancelButton.grid(row=r, column=1)
        r += 1

        settings_panel = tk.Frame(self)

        panel = tk.Frame(settings_panel)
        tk.Label(panel, text="Paper Format").pack()
        tk.Radiobutton(panel, text="A4", value=1.0, variable=self.settings.scale).pack(anchor=tk.W)
        tk.Radiobutton(panel, text="A5", value=2 ** (-0.5), variable=self.settings.scale).pack(anchor=tk.W)
        tk.Radiobutton(panel, text="A6", value=0.5, variable=self.settings.scale).pack(anchor=tk.W)
        panel.pack(side=tk.LEFT, anchor=tk.N)

        panel = tk.Frame(settings_panel)
        tk.Label(panel, text="File Format").pack()
        tk.Radiobutton(panel, text="PNG", value='.png', variable=self.settings.extension).pack(anchor=tk.W)
        tk.Radiobutton(panel, text="JPG", value='.jpg', variable=self.settings.extension).pack(anchor=tk.W)
        panel.pack(side=tk.LEFT, anchor=tk.N)

        panel = tk.Frame(settings_panel)
        tk.Label(panel, text="Scan Mode").pack()
        tk.Radiobutton(panel, text="Color", value='color', variable=self.settings.scan_mode).pack(anchor=tk.W)
        tk.Radiobutton(panel, text="Gray", value='gray', variable=self.settings.scan_mode).pack(anchor=tk.W)
        tk.Radiobutton(panel, text="Lineart", value='lineart', variable=self.settings.scan_mode).pack(anchor=tk.W)
        panel.pack(side=tk.LEFT, anchor=tk.N)

        settings_panel.grid(row=r, column=0, columnspan=2)
        r += 1


        self.statusLabel = Label(self, text="Idle")
        self.statusLabel.grid(row=r, column=0, columnspan=2)

    def _checkAlive(self):
        if self.worker is None:
            return
        if self.worker.is_alive():
            self.after(100, self._checkAlive)
            self.elapsed += 1
            self.statusLabel.config(text='Scanning, please wait... (%.1f s)' % (self.elapsed/10.0))
        else:
            self.worker = None
            self.okButton.config(state=NORMAL)
            self.numberSuffix.invoke('buttonup')
            self.newNameEntry.focus_set()
            self.statusLabel.config(text='Idle (last scan: %.1f s)' % (self.elapsed/10.0))

    def _ext(self):
        return self.settings.ext()

    def scan(self):
        target = '%s%03d%s' % (self.newName.get(), int(self.numberSuffix.get()), self._ext(), )
        if os.path.exists(target):
            if not tkMessageBox.askokcancel(title='Scan Images', message='File exists. Overwrite?'):
                print 'Not scanning: %s - file exists!' % target
                new_name = self.newName.get()
                for i in xrange(int(self.numberSuffix.get()), 1000):
                    new_target = '%s%03d.%s' % (new_name, int(self.numberSuffix.get()), self._ext(), )
                    if not os.path.exists(new_target):
                        print 'Next available filename: %s' % (new_target, )
                        self.numberSuffix.delete(0, 'end')
                        self.numberSuffix.insert(0, i)
#.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:meats,代码行数:103,代码来源:scan.py

示例11: RelyGUI

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

#.........这里部分代码省略.........
    ROWS = 20
    BORDER = 5
    short_wid = 2
    med_wid = 4
    long_wid = 6
    short_fmt = "%2d"
    med_fmt = "%4d"
    long_fmt = "%6d"

    # references to the input widget fields (I know ...)

    def do_disk(self):
        """ calculate disk reliability """
        self.getCfgInfo()
        self.doit(self.cfg, "disk")

    def do_raid(self):
        """ calculate raid reliability """
        self.getCfgInfo()
        self.doit(self.cfg, "raid")

    def do_rados(self):
        """ calculate RADOS reliability """
        self.getCfgInfo()
        self.doit(self.cfg, "rados")

    def do_sites(self):
        """ calculate Multi-Site RADOS reliability """
        self.getCfgInfo()
        self.doit(self.cfg, "multi")

    def diskchoice(self, value):
        """ change default FIT and NRE rates to match disk selection """
        self.disk_nre.delete(0, END)
        self.disk_nre.insert(0, self.nre_map[value])
        self.disk_fit.delete(0, END)
        self.disk_fit.insert(0, self.fit_map[value])
        self.disk_fit2.delete(0, END)
        self.disk_fit2.insert(0, self.fit_map[value])

    def raidchoice(self, value):
        """ change default # of volumes to match RAID levels """
        self.raid_vols.delete(0, END)
        self.raid_vols.insert(0, self.vol_map[value])

    def __init__(self, cfg, doit):
        """ create the GUI panel widgets
            cfg -- parameter values (input and output)
            doit -- method to call to run simulations
            """

        # gather the basic parameters
        self.cfg = cfg
        self.doit = doit

        self.root = Tk()
        self.root.title('Data Reliability Model')
        t = Frame(self.root, bd=2 * self.BORDER)
        # w.iconbitmap(default='inktank.ico')   # ? windows only ?

        # left stack (DISK)
        f = Frame(t, bd=self.BORDER, relief=RIDGE)
        r = 1
        Label(f, text="Disk Type").grid(row=r)
        self.disk_type = StringVar(f)
        self.disk_type.set(self.diskTypes[0])
开发者ID:amwang25,项目名称:ceph-tools,代码行数:70,代码来源:RelyGUI.py


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