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


Python tkinter.Entry类代码示例

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


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

示例1: __init__

 def __init__(self, master):
     """
     Establish the GUI of this popup
     """
     BuilderPopup.__init__(self, master)
     self.data = (0, 0, 0)
     self.radius = Label(self.top, text="Radius")
     self.radius_entry = Entry(self.top, width=self.width, bd=self.bd)
     self.n_circles_entry = Entry(self.top, width=self.width, bd=self.bd)
     self.n_circles_label = Label(self.top, text="Number of circles")
     self.center = Label(self.top, text="Center")
     self.center_entry = Entry(self.top, width=self.width, bd=self.bd)
     self.spindles = Label(self.top, text="Number of \"Roots\"")
     self.spindles_entry = Entry(self.top, width=self.width, bd=self.bd)
     self.build_spindle_submit = Button(self.top, text="Build!", command=self.cleanup)
     self.top.bind("<Return>", self.cleanup)
     self.radius.grid(row=0, column=0)
     self.radius_entry.grid(row=0, column=1)
     self.n_circles_label.grid(row=1, column=0)
     self.n_circles_entry.grid(row=1, column=1)
     self.center.grid(row=2, column=0)
     self.center_entry.grid(row=2, column=1)
     self.spindles_entry.grid(row=3, column=1)
     self.spindles.grid(row=3, column=0)
     self.build_spindle_submit.grid(row=4, column=0, columnspan=2)
     self.top_left = 0
     self.bottom_right = 0
     self.radius_entry.focus()
开发者ID:SamuelDoud,项目名称:complex-homotopy,代码行数:28,代码来源:BuilderWindows.py

示例2: ProgramWidget

class ProgramWidget(Frame):

    def __init__(self, parent, client):
        super(ProgramWidget, self).__init__(parent)
        self.client = client
        self.client.onProgramChange = self.programChanged

        self.programLabel = Label(self, text = 'Program:')
        self.programLabel.grid(row = 0, column = 0)
        self.programEntry = Entry(self, text = 'Program name',
                                  state = 'readonly')
        self.programEntry.grid(row = 0, column = 1)
        self.buttonPanel = Frame(self)
        self.buttonPanel.grid(row = 1, column = 0, columnspan = 2, sticky = W)
        self.newButton = Button(self.buttonPanel, text='New',
                                command = self.newProgram)
        self.newButton.pack(side = LEFT)

    def programChanged(self):
        self.__setProgramText(str(self.client.state))

    def __setProgramText(self, text):
        self.programEntry.configure(state = NORMAL)
        self.programEntry.delete(0)
        self.programEntry.insert(0, text)
        self.programEntry.configure(state = 'readonly')

    def newProgram(self):
        self.client.makeNewProgram()
开发者ID:mindhog,项目名称:mawb,代码行数:29,代码来源:tkui.py

示例3: GuiGenerateCount

class GuiGenerateCount(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.pack()
        
        #step increment len
        self._stepLenFrm  = Frame(self); self._stepLenFrm.pack()
        self._stepLenLbl  = Label(self._stepLenFrm, text="Step Len: ");   self._stepLenLbl.pack(side=LEFT)
        self._stepLenSpin = Spinbox(self._stepLenFrm, from_=0, to=1000); self._stepLenSpin.pack(side=LEFT)
        
        #start value
        self._startFrm  = Frame(self); self._startFrm.pack()
        self._startLbl  = Label(self._startFrm, text="Start Value: ");   self._startLbl.pack(side=LEFT)
        self._startTxt  = Entry(self._startFrm);   self._startTxt.pack(side=LEFT)
        self._startTxt.insert(0, "0")
        
    def getSettings(self):
        return  {   "StepLen":      self._stepLenSpin.get(),
                    "StartValue":   self._startTxt.get()
                }
    
    def getName(self):
        return "Counter"
        
    def getGeneratorFunction(self):
        return generateCounter
开发者ID:awaken1988,项目名称:pyTools,代码行数:27,代码来源:tas_bytegenerator.py

示例4: show_captcha

    def show_captcha(self,img_file):
        dialogRoot = Tk()
        dialogRoot.title("Input text.")
    
        img = PhotoImage(file=img_file)
    
        frame = Frame(dialogRoot)
    
        imal = Label(frame, image=img)
        imal.pack()
    
        label = Label(frame)
        label['text'] = "Your Input:"
        label.pack(side=LEFT)
    
        inputEntry = Entry(frame)
        inputEntry["width"] = 50
        inputEntry.pack(side=LEFT)
    
        def getInputText():
            '''callback of button'''
            # global inputEntry, dialogRoot
            if inputEntry.get().strip() == "":
                print("Please enter a message.")
            else:
                self.captcha_ans = inputEntry.get().strip()
                dialogRoot.destroy()

    
        button = Button(frame, text="Submit", command=getInputText)
        button.pack(side=LEFT)
    
        frame.pack()
        dialogRoot.mainloop()
开发者ID:fscnick,项目名称:RapidgatorDownloader,代码行数:34,代码来源:OtherUtility.py

示例5: BMI

class BMI(Frame):
    'Body Mass Index app'
    def __init__(self,parent=None):
        'constructor'
        Frame.__init__(self, parent)
        self.grid()
        BMI.make_widgets(self)

    def make_widgets(self):
        'defines BMI widgets'
        Label(self,text='Enter your height: ').grid(row=0,column=0)
        self.htEnt=Entry(self)
        self.htEnt.grid(row=0,column=1)
        Label(self,text='Enter your weight: ').grid(row=1,column=0)
        self.wtEnt=Entry(self)
        self.wtEnt.grid(row=1,column=1)
        Button(self,text='Compute BMI',command=self.compute).grid(row=2,column=0,columnspan=2)

    def compute(self):
        'the handler for button "Compute BMI"'
        try:
            hgt=eval(self.htEnt.get())
            wgt=eval(self.wtEnt.get())
            res=wgt*703/hgt**2
            showinfo(title='Result',message='Your BMI is {}'.format(res))
        except:
            showinfo(title='Ooops!',message='Invalid number!')
        self.wtEnt.delete(0,END)
        self.htEnt.delete(0,END)
开发者ID:brandonPauly,项目名称:pythonToys,代码行数:29,代码来源:csc242hw5.py

示例6: guiSetup

    def guiSetup(self):    # Setups GUI
        self.counter = 0
        self.searched = []
        self.counter2 = 0

        self.f1 = Frame(self.win)  # Top frame
        self.f1.grid(row=0,column=1)

        l1 = Label(self.f1, text = 'Number Search File')
        l1.grid(row=0,column=0)                                 # Search Labels
        l2 = Label(self.f1,text = 'Number Bank File    ')
        l2.grid(row = 1, column = 0)

        self.e1 = Entry(self.f1,state = 'readonly')   # Num Search File Display
        self.e1.grid(row = 0, column =1,columnspan = 6 )

        self.e2 = Entry(self.f1,state = 'readonly')  # Num Bank File Display
        self.e2.grid(row=1,column=1,columnspan = 6)

        self.f2 = Frame(self.win)  # Bottom Frame, holds grid
        self.f2.grid(row = 2, column = 1)

        self.f3 = Frame(self.win, relief = 'raised', border = 4) # Holds num bank numbers
        self.f3.grid(row = 2, column = 2)

        b1 = Button(self.f1,text = 'Select File',command = self.openNSClicked) # Search file open
        b1.grid(row = 0, column = 8)

        b2 = Button(self.f1,text = 'Select File', command=self.openNBClicked)  # Bank file open
        b2.grid(row = 1, column = 8)

        b3 = Button(self.f1,text = 'Generate Number Search',command=self.generate) # generates grid
        b3.grid(row=2,column=0)

        self.functionRan = [False,False] # shows if both files have been selected
开发者ID:snitsnit,项目名称:Misc-Portfolio,代码行数:35,代码来源:NumGame.py

示例7: draw_setup_screen

    def draw_setup_screen(self):
        """User setup screen"""
        self.canvas.delete(ALL)
        cx, cy = self.width/2, self.height/2
        text = "Number of Users (1-{})".format(self.max_users)
        font = ("Impact", 24)
        self.canvas.create_text(cx, 0.4*cy, text=text, font=font)
        self.num_users_entry = Entry(self.canvas, justify=CENTER)
        self.canvas.create_window(cx, 0.5*cy, window=self.num_users_entry)
        self.num_users_entry.insert(0, str(self.default_users))

        text = "Number of Coaches"
        self.canvas.create_text(cx, 0.6*cy, text=text, font=font)
        self.num_coaches_entry = Entry(self.canvas, justify=CENTER)
        self.canvas.create_window(cx, 0.7*cy, window=self.num_coaches_entry)
        self.num_coaches_entry.insert(0, str(self.default_coaches))

        text = "Max Number of Students"
        self.canvas.create_text(cx, 0.8*cy, text=text, font=font)
        self.num_students_entry = Entry(self.canvas, justify=CENTER)
        self.canvas.create_window(cx, 0.9*cy, window=self.num_students_entry)
        self.num_students_entry.insert(0, str(self.default_students))

        self.button = Button(cx, 1.5*cy, 0.3*cx, 0.2*cy, "Begin")
        self.button.draw(self.canvas)
开发者ID:rmaratos,项目名称:infection,代码行数:25,代码来源:visual.py

示例8: create_widgets

    def create_widgets(self):
        """ Login form """

        frame_top = Frame(self, pady=15, padx=15)
        frame_top.pack()

        self.email = StringVar()
        self.email_label = Label(frame_top, text="Email")
        self.email_entry = Entry(frame_top, textvariable=self.email)

        self.password = StringVar()
        self.password_label = Label(frame_top, text="Password")
        self.password_entry = Entry(frame_top,
                                    textvariable=self.password, show='*')

        frame_bottom = Frame(self, pady=15, padx=15)
        frame_bottom.pack()

        self.submit = Button(frame_bottom)
        self.submit["text"] = "Login"
        self.submit["command"] = self.sign_in

        #layout widgets in grid
        self.email_label.grid(row=1, column=0)
        self.email_entry.grid(row=1, column=1)
        self.password_label.grid(row=2, column=0)
        self.password_entry.grid(row=2, column=1)
        self.submit.grid(row=2, column=0)
开发者ID:garthreckers,项目名称:p01-desktop,代码行数:28,代码来源:loginscreen.py

示例9: initInterfaceZone

    def initInterfaceZone(self):
        # Draw the play, step and loading buttons
        self.interfaceFrame = Frame(self, background="dark gray")
        self.playFrame = Frame(self.interfaceFrame, background="dark gray")
        self.loadFrame = Frame(self.interfaceFrame, background="dark gray")

        self.isPlaying = False

        #Do the run buttons
        playButton = Button(self.playFrame, text=">", command=self.playPress)
        playButton.grid(row=0,column=0)
        pauseButton = Button(self.playFrame, text="||", command=self.pausePress)
        pauseButton.grid(row=0,column=1)
        stepBackButton = Button(self.playFrame, text="|<", command=self.stepBackPress)
        stepBackButton.grid(row=1,column=0)
        stepForwardButton = Button(self.playFrame, text=">|", command=self.stepForwardPress)
        stepForwardButton.grid(row=1,column=1)

        self.playFrame.pack(side=LEFT, expand=1, fill=BOTH)

        #Do the load-y stuff
        self.boardInputField = Entry(self.loadFrame)
        self.boardInputField.grid(row=0, column=0)
        boardInputButton = Button(self.loadFrame, text="Load Board", command=self.loadBoardPress)
        boardInputButton.grid(row=0, column=1)
        self.moveInputField = Entry(self.loadFrame)
        self.moveInputField.grid(row=1,column=0)
        moveInputButton = Button(self.loadFrame, text="Load Moves", command=self.loadMovesPress)
        moveInputButton.grid(row=1, column=1)

        self.loadFrame.pack(side=LEFT, expand=1, fill=BOTH)

        self.interfaceFrame.pack(side=BOTTOM)
开发者ID:j-salazar,项目名称:block-solver,代码行数:33,代码来源:blockgame.py

示例10: ua_win_tk

def ua_win_tk(url, pipe = None):
    from tkinter import Tk, Frame, Label, Entry, StringVar, BOTH, Button, RIGHT
    import sys
    sys.stdout.flush()
    instructions = "Visit the following URL to authorize the application:"
    response = {"x": False}
    root = Tk()
    root.title("oAuth2 Authorization Required")
    webbox = Frame(root)
    instructions = Label(webbox, text = instructions)
    instructions.pack(padx = 5, pady = 5)
    urlstr = StringVar(value = url)
    urlbox = Entry(webbox, textvariable = urlstr, state = "readonly")
    urlbox.pack(padx = 5, pady = 5)
    def open_browser():
        from subprocess import Popen
        p = Popen(["sensible-browser", url])
    browserbutton = Button(webbox, text = "Open in web browser", command = open_browser)
    browserbutton.pack(padx = 5, pady = 5)
    webbox.pack(fill = BOTH, expand = 1)
    if pipe:
        def poll():
            if pipe.poll():
                root.destroy()
                #Mutability ftw... wat
                response["x"] = True
            else:
                root.after(300, poll)
        root.after(300, poll)
    cancelbutton = Button(root, text = "Cancel", command = root.destroy)
    cancelbutton.pack(side = RIGHT, padx = 5, pady = 5)
    root.mainloop()
    return response["x"]
开发者ID:pyokagan,项目名称:pyoauth2client,代码行数:33,代码来源:ui.py

示例11: __init__

    def __init__(self, master=None):
        # Avoiding to send it continuously.
        self.lock = False

        Frame.__init__(self, master)
        self.grid()
        self.master = master
        # Setting for ComboBox.
        self.url_lang_combobox_str = StringVar()
        self.url_lang_combobox_list = lang_list
        # UI components.
        self.receiver_email_text = Label(self, text="Receiver:")
        self.receiver_email_field = Entry(self, width=50)
        self.subject_text = Label(self, text='Subject:')
        self.subject_field = Entry(self, width=50)
        self.receiver_name_text = Label(self, text='Name:')
        self.receiver_name_field = Entry(self, width=50)
        self.url_lang_text = Label(self, text='Link lang:')
        self.url_lang_combobox = Combobox(self, textvariable=self.url_lang_combobox_str, values=self.url_lang_combobox_list, state='readonly')
        self.send_progressbar = Progressbar(self, orient='horizontal', length=500, mode='determinate', maximum=300)
        self.send_button = Button(self, text='Send', command=self._send_mail)
        self.quit_button = Button(self, text='Exit', command=self.__exit)
        self.log_msg_text = ScrolledText(self)
        # Attachment.
        self.mail_attachment_list = attachment_list[:]
        self.url_lang_link_title = None
        self.url_lang_link = copy.deepcopy(content_link)
        # Mailer
        self._mailer = None

        # Let Mailer can control components.
        Mailer.window_content = self

        self.__create_widgets()
开发者ID:pokk,项目名称:Mailer,代码行数:34,代码来源:auto_mailer.py

示例12: make_widgets

 def make_widgets(self):
     'defines Ed widgets'
     self.exp=Entry(self)
     self.exp.grid(row=0,column=0)
     self.res=Entry(self)
     self.res.grid(row=0,column=1)
     Button(self,text='Enter',command=self.evaluate).grid(row=0,column=3)
开发者ID:brandonPauly,项目名称:pythonToys,代码行数:7,代码来源:csc242hw5.py

示例13: PasswordDialog

class PasswordDialog(Dialog):

    def __init__(self, title, prompt, parent):
        self.prompt = prompt
        Dialog.__init__(self, parent, title)

    def body(self, master):
        from tkinter import Label
        from tkinter import Entry
        from tkinter import Checkbutton
        from tkinter import IntVar
        from tkinter import W

        self.checkVar = IntVar()

        Label(master, text=self.prompt).grid(row=0, sticky=W)

        self.e1 = Entry(master)

        self.e1.grid(row=0, column=1)

        self.cb = Checkbutton(master, text="Save to keychain", variable=self.checkVar)
        self.cb.pack()
        self.cb.grid(row=1, columnspan=2, sticky=W)
        self.e1.configure(show='*')

    def apply(self):
        self.result = (self.e1.get(), self.checkVar.get() == 1)
开发者ID:WaffleTime,项目名称:GUIDE,代码行数:28,代码来源:password_dialog.py

示例14: Application

class Application(object):

    def __init__(self):
        self.helper = YouDaoHelper()
        self.window = Tk()
        self.window.title(u'知了词典')
        self.window.geometry("280x350+700+300")
        # 输入框
        self.entry = Entry(self.window)
        self.entry.place(x=10, y=10, width=200, height=25)

        # 提交按钮
        self.submit_btn = Button(self.window, text=u'查询', command=self.submit)
        self.submit_btn.place(x=220, y=10, width=50, height=25)

        # 翻译结果标题
        self.title_label = Label(self.window, text=u'翻译结果:')
        self.title_label.place(x=10, y=55)

        # 翻译结果
        self.result_text = Text(self.window, background='#ccc')
        self.result_text.place(x=10, y=75, width=260, height=265)

    def submit(self):
        # 1. 从输入框中获取用户输入的值
        content = self.entry.get()
        # 2. 把这个值发送给有道的服务器,进行翻译
        result = self.helper.crawl(content)
        # 3. 把结果放在底部的Text控件中
        self.result_text.delete(1.0,END)
        self.result_text.insert(END,result)

    def run(self):
        self.window.mainloop()
开发者ID:EleVenPerfect,项目名称:OTHERS,代码行数:34,代码来源:youdaofanyi.py

示例15: initialize

	def initialize(self):
		short_label = Label(self, text="Short Name")
		short_label.grid(row=0, column=0, sticky="W", padx=5)

		self.new_short_box = Entry(self, width=10)
		self.new_short_box.focus_set()
		self.new_short_box.grid(row=1, column=0, sticky="W", padx=5)

		item_label = Label(self, text="Item Name")
		item_label.grid(row=0, column=1)

		self.new_item_box = Entry(self, width=40)
		self.new_item_box.grid(row=1, column=1, sticky="EW")

		amount_label = Label(self, text="Amount")
		amount_label.grid(row=0, column=2, sticky="EW")

		self.new_amount_box = Entry(self, width=5)
		self.new_amount_box.grid(row=1, column=2, padx=10, sticky="EW")

		cancel_button = Button(self, text="Cancel", width=10, command=self.cancel)
		self.bind("<Escape>", self.cancel)
		cancel_button.grid(row=3, column=0, pady=10, padx=5, sticky="W")

		ok_button = Button(self, text="OK", width=10, command=self.ok)
		self.bind("<Return>", self.ok)
		ok_button.grid(row=3, column=2, pady=10, sticky="E")

		self.bind("<Return>", self.ok)
		self.bind("<Escape>", self.cancel)
开发者ID:nalexander50,项目名称:MCRC-JSON-Creator,代码行数:30,代码来源:Edit_Ingredient_Modal.py


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