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


Python Tkinter.Spinbox类代码示例

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


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

示例1: initUI

    def initUI(self):
        self.parent.title("Buttons")
        self.style = Style()
        self.style.theme_use("default")

        frame = Frame(self, relief=GROOVE, borderwidth=5)
        frame.pack(fill=BOTH, expand=1)
        self.pack(fill = BOTH, expand = 1)

        self.imageLabel = Label(frame, image = "")
        self.imageLabel.pack(fill=BOTH, expand=1)

        closeButton = Button(self, text="Close")
        closeButton.pack(side=RIGHT)
        okButton = Button(self, text="OK")
        okButton.pack(side=RIGHT)

        options = [item for item in dir(cv2.cv) if item.startswith("CV_CAP_PROP")]
        option = OptionMenu(self, self.key, *options)
        self.key.set(options[0])
        option.pack(side="left")

        spin = Spinbox(self, from_=0, to=1, increment=0.05)
        self.val = spin.get()
        spin.pack(side="left")
开发者ID:fredericgo,项目名称:PyCV-Processing,代码行数:25,代码来源:frame.py

示例2: StarterWindow

class StarterWindow(Tk):
    def __init__(self):
        Tk.__init__(self)
        self.wm_title("FRCA QBase Reader - Start Menu")
        self.exambtn = Button(self, text="start an exam", command=self.startExam)
        self.exambtn.pack()
        self.maxquestvar = IntVar()
        self.maxquest = Spinbox(self, from_=1, to=1667, width=4, textvariable=self.maxquestvar)
        self.maxquest.pack()
        self.questbtn = Button(self, text="start single questions", command=self.startQuestions)
        self.questbtn.pack()
        self.um = """User manual:\n
		Start either an exam or single questions\n
		Go to next question either with mouse or the <right arrow>\n
		Toggle checkboxes either with mouse or <keyboard buttons 1-5>\n
		In single question mode, show answer either with mouse or <return>\n
		In exam mode, results will display after the set question number\n
		Text can be made bigger/smaller with <Up> or <Down> keyboard arrows"""
        self.usermanual = Label(self, text=self.um, justify=LEFT)
        self.usermanual.pack()

    def startExam(self):
        call(["python", "exam.py", str(self.maxquestvar.get())])

    def startQuestions(self):
        call(["python", "quest_by_quest.py"])
开发者ID:Rscho314,项目名称:FRCAQBaseReader2,代码行数:26,代码来源:starter.py

示例3: __init__

	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)
开发者ID:jbernardis,项目名称:repraphost,代码行数:32,代码来源:extruder.py

示例4: createSnakeSpinBoxes

    def createSnakeSpinBoxes(self):
        frame = Frame(self.menuFrame, width=300)

        from_ = 0
        to = 255
        vcmd = (self.register(self.validateSpinBox),'%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W')

        label1 = Label(frame, text="Parametr 1")
        self.snakeValue1 = StringVar()
        self.snakeSpinBox = Spinbox(frame, textvariable=self.snakeValue1, width=4, from_=from_, to=to, validate="key", validatecommand=vcmd)
        
        label2 = Label(frame, text="Parametr 2")
        self.snakeValue2 = StringVar()
        self.snakeSpinBox2 = Spinbox(frame, textvariable=self.snakeValue2, width=4, from_=from_, to=to, validate="key", validatecommand=vcmd)
        
        label3 = Label(frame, text="Parametr 3")
        self.snakeValue3 = StringVar()
        self.snakeSpinBox3 = Spinbox(frame, textvariable=self.snakeValue3, width=4, from_=from_, to=to, validate="key", validatecommand=vcmd)
        
        label1.grid(row=0, column=0, padx=(0,10), stick=N+W)
        label2.grid(row=1, column=0, padx=(0,10), stick=N+W)
        label3.grid(row=2, column=0, padx=(0,10), stick=N+W)
        self.snakeSpinBox.grid(row=0, column=1, stick=N+W)
        self.snakeSpinBox2.grid(row=1, column=1, stick=N+W)
        self.snakeSpinBox3.grid(row=2, column=1, stick=N+W)
        
        return frame
开发者ID:pancur,项目名称:khf,代码行数:27,代码来源:Interface.py

示例5: ventanaImprimir

    def ventanaImprimir(self):
        t = Toplevel(self)
        t.wm_title("Imprimir")

        Label(t, text="Numero de Copias por etiqueta").pack()
        w = Spinbox(t, from_=1, to=10)
        w.pack()

        buttonImprimir = Button(t, text="Imprimir",  command=lambda:self.imprimir(int(w.get()),t))
        buttonImprimir.pack()
开发者ID:rached193,项目名称:Caritas,代码行数:10,代码来源:caritas.py

示例6: create_entry

 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,代码行数:10,代码来源:outputopts.py

示例7: LabeledSpin

class LabeledSpin(Frame):
    def __init__(self, **kwargs):
        master = None if 'master' not in kwargs else kwargs['master']
        title = '' if 'title' not in kwargs else kwargs['title']
        Frame.__init__(self, master)
        self.val = IntVar()
        self.lbl = Label(text=title)
        self.lbl.grid(row=0, column=0, sticky=W, in_=self)
        self.Spin = Spinbox(textvariable=self.val)
        self.Spin.grid(row=0, column=1, sticky=W, in_=self)
开发者ID:WillBickerstaff,项目名称:pycycle,代码行数:10,代码来源:genericwidgets.py

示例8: initUI

    def initUI(self):
        # Main Window
        self.parent.title("gBot")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        # Debug Window
        Toplevel1 = Toplevel(self)
        Toplevel1.title("gBot Debug Console")
        self.pack(fill=BOTH, expand=1)
        TL_T1 = Text(Toplevel1, width=50)
        TL_T1.pack()
        Toplevel1.state("withdrawn")
        Toplevel1.protocol('WM_DELETE_WINDOW', lambda:Toplevel1.state("withdrawn"))
        Toplevel1.attributes("-topmost", True)

        # Username Input
        L1 = Label(self, text="G+ User Name")
        L1.grid(row=0, column=0, sticky=E, ipady=1)
        E1 = Entry(self, width=30)
        E1.grid(row=0, column=1, ipady=1, sticky=E)

        # Password Input
        L2 = Label(self, text="G+ Password")
        L2.grid(row=1, column=0, sticky=E, ipady=1)
        E2 = Entry(self, width=30)
        E2.grid(row=1, column=1, ipady=1, sticky=E)

        # Output Path Input
        L3 = Label(self, text="Output Path")
        L3.grid(row=2, column=0, sticky=E, pady=1)
        E3 = Entry(self, width=30)
        E3.grid(row=2, column=1, ipady=1, sticky=E)
        E3.insert(0, "%s\links.txt" % (os.getcwd()))

        # Num Posts
        L4 = Label(self, text="# Of Posts")
        L4.grid(row=3, column=0, sticky=E, pady=1)
        S1 = Spinbox(self, from_=1, to=9999999, width=28)
        S1.grid(row=3, column=1, ipady=1, sticky=E)
        
        # Post Input
        T1 = Text(self, width=30)
        T1.grid(row=5, columnspan=2, sticky=W+E, pady=1)
        
        # Start button
        B1 = Button(self, text="Start Posting", command=lambda:self.doPosting(B1,TL_T1,E1.get(),E2.get(),T1.get(1.0,END),E3.get(),S1.get()))
        B1.grid(row=6,columnspan=2, sticky=W+E)

        # Debug button
        B2 = Button(self, text="Debug log", command=lambda:Toplevel1.state("normal"))
        B2.grid(row=7, columnspan=2, sticky=W+E)

        self.addDebug(TL_T1,"Started successfully")
开发者ID:IRDeNial,项目名称:gBot,代码行数:55,代码来源:main.py

示例9: __init__

	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)
开发者ID:jbernardis,项目名称:repraphost,代码行数:49,代码来源:movecontrol.py

示例10: __createWidgets

 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)
开发者ID:WillBickerstaff,项目名称:sundial,代码行数:28,代码来源:app.py

示例11: __init__

 def __init__(self, parent=None, text='Year:', min_value=1950, max_value=2100, **kwargs):
     # NOTE: This class used to be a subclass of Frame, but it did not grid properly
     #Frame.__init__(self, parent)
     self.label = Label(parent, text=text)
     self.year = StringVar()
     self.year_selector = Spinbox(parent, from_=min_value, to=max_value, textvariable=self.year, command=self.on_change, width=5)
     self.set_args()
开发者ID:jhavstad,项目名称:model_runner,代码行数:7,代码来源:ModelRunnerGUI.py

示例12: __init__

    def __init__(self):
        # TTT related
        self.ttt = Board(ply=9)
        self.human_first = True

        # UI related
        self.root = Tk()
        self.root.resizable(0, 0)
        self.root.title("3D TTT")

        # TTT frames
        self.ttt_frames = [Frame(self.root) for x in range(3)]
        for i in range(3):
            self.ttt_frames[i].grid(row=0, column=i)
        self.button_pos = dict()
        self._init_board()

        # control frame
        self.control_frame = Frame(self.root, padx=5, pady=5)
        self.control_frame.grid(row=1, column=1)
        self.new_game_btn = Button(self.control_frame, text='New Game', \
                command=lambda: self.reset())
        self.new_game_btn.pack(side=LEFT, fill=BOTH, expand=True)
        self.toggle_human_first_btn = Button(self.control_frame, \
                text='Human First', command=lambda: self.toggle_human_first())
        self.toggle_human_first_btn.pack(side=RIGHT, fill=BOTH, expand=True)
        self.ply_box = Spinbox(self.control_frame, from_=1, to=20, \
                textvariable=self.ttt.difficulty, command=lambda: self.reset())
        self.ply_box.pack(side=RIGHT, fill=BOTH, expand=True)

        # start UI
        self.update_pieces()
        self.start()
        self.root.mainloop()
开发者ID:Battleroid,项目名称:3ttt,代码行数:34,代码来源:ui.py

示例13: YearSelector

class YearSelector():
    def __init__(self, parent=None, text='Year:', min_value=1950, max_value=2100, **kwargs):
        # NOTE: This class used to be a subclass of Frame, but it did not grid properly
        #Frame.__init__(self, parent)
        self.label = Label(parent, text=text)
        self.year = StringVar()
        self.year_selector = Spinbox(parent, from_=min_value, to=max_value, textvariable=self.year, command=self.on_change, width=5)
        self.set_args()

    def set_args(self, **kwargs):
        self.check_other_func = kwargs['check_other_func'] if 'check_other_func' in kwargs else None

    def get_value(self):
        value = int(self.year.get())
        return value

    def set_value(self, value):
        self.year.set(value)

    def set_grid(self, row=0, padx=0, pady=0):
        #self.grid(row=row)
        self.label.grid(row=row, column=0, sticky='e')
        self.year_selector.grid(row=row, column=1, padx=padx, pady=pady, sticky='w')

    def on_change(self):
        if self.check_other_func != None:
            value = int(self.year.get())
            new_value = self.check_other_func(value)
            if value != new_value:
                self.set_value(new_value)
        else:
            pass

    def get_less_than(self, compare_value):
        value = int(self.year.get())
        compare_value = int(compare_value)
        if value <= compare_value:
            return value
        return compare_value

    def get_greater_than(self, compare_value):
        value = int(self.year.get())
        compare_value = int(compare_value)
        if value >= compare_value:
            return value
        return compare_value
开发者ID:jhavstad,项目名称:model_runner,代码行数:46,代码来源:ModelRunnerGUI.py

示例14: createCogSpinBoxes

    def createCogSpinBoxes(self):
        frame = Frame(self.menuFrame, width=300)

        from_ = 0
        to = 100
        vcmd = (self.register(self.validateSpinBox),'%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W')

        label1 = Label(frame, text="Wsp. kary za rzadkość")
        self.densityCoefficient = StringVar(value="10")
        self.cogSpinBox = Spinbox(frame, textvariable=self.densityCoefficient, width=4, from_=from_, to=to, validate="key", validatecommand=vcmd)
        
        label2 = Label(frame, text="Wsp. kary za odległość")
        self.distanceFromCenterCoefficient = StringVar(value="60")
        self.cogSpinBox2 = Spinbox(frame, textvariable=self.distanceFromCenterCoefficient, width=4, from_=from_, to=to, validate="key", validatecommand=vcmd)
        
        label1.grid(row=0, column=0, padx=(0,10), stick=N+W)
        label2.grid(row=1, column=0, padx=(0,10), stick=N+W)
        self.cogSpinBox.grid(row=0, column=1, stick=N+W)
        self.cogSpinBox2.grid(row=1, column=1, stick=N+W)
        
        return frame
开发者ID:pancur,项目名称:khf,代码行数:21,代码来源:Interface.py

示例15: printTurn

 def printTurn(self):
     frameS = PanedWindow(self.FrameInfo, orient=HORIZONTAL)
     turns = Label(frameS, text="Tour :")
     self.var.set(str(self.selectTurn))
     self.Spin_T = Spinbox(frameS, values=self.turns.keys(), command =
             self.updateSpin_turn ,textvariable=self.var)
     self.Spin_T.bind('<Return>', self.validateTurn)
     turns.pack()
     self.Spin_T.pack()
     frameS.add(turns)
     frameS.add(self.Spin_T)
     frameS.pack()
     self.frameT = frameS
开发者ID:DoumbiaAmadou,项目名称:programmationComparee,代码行数:13,代码来源:antroidGUI.py


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