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


Python Entry.get方法代码示例

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


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

示例1: SettingsDialog

# 需要导入模块: from tkinter import Entry [as 别名]
# 或者: from tkinter.Entry import get [as 别名]
class SettingsDialog(simpledialog.Dialog):
    def __init__(self, *args, **kwargs):
        self.config = kwargs.pop("config")
        self.config_file_name = kwargs.pop("config_file_name")
        super(SettingsDialog, self).__init__(*args, **kwargs)

    def body(self, master):
        Label(master, text="Team").grid(row=0)
        Label(master, text="Case").grid(row=1)

        # self.case_entry = Entry(master, textvariable=self.case).grid(row=0, column=1)
        # self.case_entry = Entry(master, textvariable=self.case).grid(row=1, column=1)
        self.case_entry = Entry(master)
        self.case_entry.grid(row=0, column=1)
        try:
            self.case_entry.insert(0, self.config.get("DEFAULT", "case"))
        except configparser.NoOptionError:
            self.case_entry.insert(0, "CASE")
        self.team_entry = Entry(master)
        self.team_entry.grid(row=1, column=1)
        try:
            self.team_entry.insert(0, self.config.get("DEFAULT", "team"))
        except configparser.NoOptionError:
            self.team_entry.insert(0, "TEAM")

        return self.case_entry  # Focus

    def apply(self):
        self.config.set("DEFAULT", "case", self.case_entry.get())
        self.config.set("DEFAULT", "team", self.team_entry.get())
        with open(self.config_file_name, 'w') as configfile:
            self.config.write(configfile)
开发者ID:qcaron,项目名称:stampede,代码行数:34,代码来源:main.py

示例2: BMI

# 需要导入模块: from tkinter import Entry [as 别名]
# 或者: from tkinter.Entry import get [as 别名]
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,代码行数:31,代码来源:csc242hw5.py

示例3: CircleBuilderPopup

# 需要导入模块: from tkinter import Entry [as 别名]
# 或者: from tkinter.Entry import get [as 别名]
class CircleBuilderPopup(BuilderPopup):
    """
    Class that launches a popup and collects user data to pass data back to the main window
    to build a circle.
    """
    def __init__(self, master):
        """
        Establish the GUI of this popup
        """
        BuilderPopup.__init__(self, master)
        self.data = (0, 0)
        self.radius = Label(self.top, text="Radius")
        self.radius_entry = Entry(self.top, width=self.width, bd=self.bd)
        self.center = Label(self.top, text="Center")
        self.center_entry = Entry(self.top, width=self.width, bd=self.bd)
        self.build_circle_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.center.grid(row=1, column=0)
        self.center_entry.grid(row=1, column=1)
        self.build_circle_submit.grid(row=2, column=0, columnspan=2)
        self.top_left = 0
        self.bottom_right = 0
        self.radius_entry.focus()

    def cleanup(self, entry=None):
        """
        Collect the data from the user and package it into object variables, then close.
        """
        center = complex(0, 0)
        if self.center_entry.get():
            center = complex(allow_constants(self.center_entry.get()))
        self.data = (float(allow_constants(self.radius_entry.get())), center)
        self.top.destroy()
开发者ID:SamuelDoud,项目名称:complex-homotopy,代码行数:37,代码来源:BuilderWindows.py

示例4: Add_Item_Modal

# 需要导入模块: from tkinter import Entry [as 别名]
# 或者: from tkinter.Entry import get [as 别名]
class Add_Item_Modal(Modal):
	def __init__(self, parent=None, title="Add Item"):
		Modal.__init__(self, parent, title, geometry="580x110" if system() == "Windows" else "485x95")

	def initialize(self):
		label = Label(self, font=("TkTextFont", 13), text="Item Name: ")
		label.grid(row=0, column=0, pady=10)

		self.item_name_box = Entry(self, font=("TkTextFont", 13), width=32)
		self.item_name_box.grid(row=0, column=1, pady=10, sticky="EW")
		self.item_name_box.focus_set()

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

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

	def ok(self, event=None):
		name = self.item_name_box.get()
		if name != "":
			self.item_name = self.item_name_box.get()
			self.destroy()

	def cancel(self, event=None):
		self.item_name = None
		self.destroy()

	def show(self):
		Modal.show(self)
		return self.item_name
开发者ID:nalexander50,项目名称:MCRC-JSON-Creator,代码行数:35,代码来源:Add_Item_Modal.py

示例5: Edit_Ingredient_Modal

# 需要导入模块: from tkinter import Entry [as 别名]
# 或者: from tkinter.Entry import get [as 别名]
class Edit_Ingredient_Modal(Modal):
	def __init__(self, parent=None, title="Add Ingredient"):
		Modal.__init__(self, parent, title, geometry="520x100" if system() == "Windows" else "565x95")

	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)

	def ok(self, event=None):
		new_short = self.new_short_box.get()
		new_name = self.new_item_box.get()
		new_amount = self.new_amount_box.get()
		if new_short is not None and new_name is not None and new_amount is not None and new_amount.isdigit():
			if new_name != "" and new_amount != "":
				self.new_short_name = new_short
				self.new_item_name = new_name
				self.new_amount = int(new_amount)
				self.destroy()

	def cancel(self, event=None):
		self.new_short_name = None
		self.new_item_name = None
		self.new_amount = None
		self.destroy()

	def show(self, current_short_name, current_name, current_amount):
		self.new_short_box.insert(0, current_short_name)
		self.new_item_box.insert(0, current_name)
		self.new_amount_box.insert(0, current_amount)
		Modal.show(self)
		return (self.new_short_name, self.new_item_name, self.new_amount)
开发者ID:nalexander50,项目名称:MCRC-JSON-Creator,代码行数:60,代码来源:Edit_Ingredient_Modal.py

示例6: Ed

# 需要导入模块: from tkinter import Entry [as 别名]
# 或者: from tkinter.Entry import get [as 别名]
class Ed(Frame):
    'Simple arithmetic education app'
    def __init__(self,parent=None):
        'constructor'
        Frame.__init__(self, parent)
        self.pack()
        Ed.make_widgets(self)
        Ed.new_problem(self)

    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)
        

    def new_problem(self):
        'creates new arithmetic problem'
        temp1=randrange(1,10)
        temp2=randrange(1,10)
        if temp1 > temp2:
            self.num1=temp1
            self.num2=temp2
        else:
            self.num1=temp2
            self.num2=temp1
        coinflip=randrange(1,3)
        if coinflip == 1:
            self.exp.insert(0,self.num1)
            self.exp.insert(END,' - ')
            self.exp.insert(END,self.num2)
            self.exp.insert(END,' =')
        else:
            self.exp.insert(0,self.num1)
            self.exp.insert(END,' + ')
            self.exp.insert(END,self.num2)
            self.exp.insert(END,' =')

    def evaluate(self):
        'handles button "Enter" clicks by comparing answer in entry to correct result'
        temp=self.exp.get()
        exprs=temp[0:5]
        try:
            reslt=self.res.get()
            if eval(exprs) == eval(reslt):
                showinfo(title='Way to go!',message='That is correct!')
                self.res.delete(0,END)
                self.exp.delete(0,END)
                Ed.new_problem(self)
            else:
                showinfo(title='Incorrect',message='Try again')
                self.res.delete(0,END)
        except:
            showinfo(title='I\'m sorry. I didn\'t get that.',message='Please enter your answer using digits (0 through 9).')
            self.res.delete(0,END)
开发者ID:brandonPauly,项目名称:pythonToys,代码行数:59,代码来源:csc242hw5.py

示例7: CreditCard

# 需要导入模块: from tkinter import Entry [as 别名]
# 或者: from tkinter.Entry import get [as 别名]
class CreditCard(Frame):
    'credit card interest calculation app'
    
    def __init__(self,parent=None):
        'constructor'
        Frame.__init__(self, parent)
        # If you use pack for the widgets in make_widgets, change
        # this to pack
        self.grid()
        CreditCard.make_widgets(self)

    def make_widgets(self):
        'makes three labels, three entry boxes, and a compute button'
        self.label1=Label(self, text='Enter the balance:').grid(row=0, column=0)
        self.label2=Label(self, text='Enter the interest rate(e.g. 9% = 0.009):').grid(row=1, column=0)
        self.label3=Label(self, text='Enter the amount of the monthly payment:').grid(row=2, column=0)

        self.balEnt=Entry(self)
        self.balEnt.grid(row=0, column=1)
        self.interestEnt=Entry(self)
        self.interestEnt.grid(row=1, column=1)
        self.monthlyEnt=Entry(self)
        self.monthlyEnt.grid(row=2, column=1)

        compTotal=Button(self, text='Compute Total', command=self.compute).grid(row=3, columnspan=2)

    def compute(self):
        'computes the amount of time it would take for interest to pay off. Handles input errors'
        months=1
        total=0
        try:
            balance=float(self.balEnt.get())
            intRate=float(self.interestEnt.get())
            monthly=float(self.monthlyEnt.get())

            while balance>0:
                if balance<monthly:
                    total+=balance
                    balance=0
                    break
                balance-=monthly
                balance+=balance*intRate
                months+=1
                total+=monthly
                
            showinfo(title='Results', message='It will take {} month(s) to pay off the balance and require a total payment of ${}.'.format(months, round(total, 2)))
            
            self.balEnt.delete(0,END)
            self.interestEnt.delete(0,END)
            self.monthlyEnt.delete(0,END)
            
        except:
            showinfo(title='Oooops!', message='Invalid Input')
            self.balEnt.delete(0,END)
            self.interestEnt.delete(0,END)
            self.monthlyEnt.delete(0,END)
开发者ID:wpank,项目名称:Python,代码行数:58,代码来源:CreditCardInterest.py

示例8: GetUrlFrame

# 需要导入模块: from tkinter import Entry [as 别名]
# 或者: from tkinter.Entry import get [as 别名]
class GetUrlFrame(Frame):
    def __init__(self, master=None, thread=None):
        Frame.__init__(self, master)
        self.controlThread=thread
        
        self.url=""
        self.urlFilter="rapidgator.net"

        self.grid()
        
        self.createWidgets()
        
        
        
    def createWidgets(self):
        self.inputText = Label(self)
        if self.inputText != None:
            self.inputText["text"] = "URL:"
            self.inputText.grid(row=0, column=0)
        else:
            pass
        
        self.inputField = Entry(self)
        if self.inputField != None:
            self.inputField["width"] = 50
            self.inputField.grid(row=0, column=1, columnspan=6)
        else:
            pass
        
        
        self.submitBtn = Button(self, command=self.clickSubmitBtn)
        if self.submitBtn != None:
            self.submitBtn["text"] = "Submit"
            self.submitBtn.grid(row=0, column=7)
        else:
            pass
        

    def clickSubmitBtn(self):
        if self.urlFilter in self.inputField.get():
            self.url=self.inputField.get()

            self.controlThread.setFileURL(self.url)
            
            self.quit()
            
        else:
            messagebox.showerror(
                        "Url error!",
                        "Not Support host site!"
                                  )
        
        
    def getSubmitURL(self):
        return self.url
开发者ID:fscnick,项目名称:RapidgatorDownloader,代码行数:57,代码来源:DialogThread.py

示例9: GuiBasicSettings

# 需要导入模块: from tkinter import Entry [as 别名]
# 或者: from tkinter.Entry import get [as 别名]
class GuiBasicSettings(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.pack()
        
        #Unit
        self.sizeUnits = {"Byte": 1, "KiB":1024, "MiB":1024**2, "GiB":1024**3}
        
        self._initFile()
        self._initSize()

    def _initFile(self):
        self._fileLbl = Label(self, text="File:       ")
        self._fileTxt = Entry(self)
        self._fileTxt.insert(0, "/tmp/out.txt")
        self._fileBtn = Button(self, text="Create", command=self._callbackFun)
        self._fileLbl.grid(row=0, column=0)
        self._fileTxt.grid(row=0, column=1)
        self._fileBtn.grid(row=0, column=2)
    
    def _initSize(self):
        self._sizeLbl = Label(self, text="FileSize:  ")
        self._sizeTxt = Entry(self)
        self._sizeTxt.insert(0, "1024")
        
        self._sizeVar    = StringVar()
        self._sizeVar.set("Byte")       #FIXME: replace "Byte" with variable
        sizeOptParam = (self, self._sizeVar) + tuple(self.sizeUnits.keys()) 
        self._sizeOptMen = OptionMenu(*sizeOptParam)
        
        self._sizeLbl.grid(row=1, column=0)
        self._sizeTxt.grid(row=1, column=1)
        self._sizeOptMen.grid(row=1, column=2)
    
    def _callbackFun(self):
        print("_callbackBtn")
        self.outerCallback()
    
    def enableButton(self, enabled=True):
        if enabled:
            self._fileBtn.config(state="normal")
        else:
            self._fileBtn.config(state="disabled")
    def getFileName(self):
        return self._fileTxt.get()
        
    def getFileSize(self):
        mult = int(self.sizeUnits[self._sizeVar.get()])
        val  = int(self._sizeTxt.get())
        return val * mult   
    
    def setCallback(self, aCallback):
        self.outerCallback = aCallback
开发者ID:awaken1988,项目名称:pyTools,代码行数:56,代码来源:tas_bytegenerator.py

示例10: LoginGui

# 需要导入模块: from tkinter import Entry [as 别名]
# 或者: from tkinter.Entry import get [as 别名]
class LoginGui(object):
    def __init__(self, root):
        self.welcome_text = 'Prihlaseny' if User.is_loaded_session() else ""

        self.response_text = StringVar(root, value=self.welcome_text)

        self.top_frame = Frame(root, width=400, height=400)

        self.middle_frame = Frame(root, width=300, height=300)

        self.top_frame.pack(fill="both", expand=True, padx=20, pady=20)
        self.middle_frame.place(in_=self.top_frame, anchor='c', relx=.5, rely=.5)

        self.l_email = Label(self.middle_frame, text="Email")
        self.e_email = Entry(self.middle_frame)

        self.l_pass = Label(self.middle_frame, text="Password")
        self.e_pass = Entry(self.middle_frame, show="*")

        self.l_sign_up = Label(self.middle_frame, text="Sign up", fg='blue', cursor='hand2')

        self.l_req_result = Label(self.middle_frame, textvariable=self.response_text)

        self.b_submit = Button(self.middle_frame, text="Login")

        self.l_email.grid(row=0, sticky=E)
        self.e_email.grid(row=0, column=1)
        self.l_pass.grid(row=1, column=0, sticky=E)
        self.e_pass.grid(row=1, column=1)
        self.b_submit.grid(row=2, column=1, sticky=E)
        self.l_sign_up.grid(row=3, column=1, sticky=E)
        self.l_req_result.grid(row=4)

        self.l_sign_up.bind('<Button-1>', self.sing_up_callback)
        self.b_submit.bind('<Button-1>', self.login)

        self.root = root
        self.root.mainloop()

    def login(self, event):
        response = User.login(self.e_email.get(), self.e_pass.get())
        self.response_text.set(response)
        if User.is_loaded_session():
            self.root.destroy()

    @staticmethod
    def sing_up_callback(event):
        webbrowser.open_new(Config.SIGN_UP_URL)

    @staticmethod
    def show_login():
        root = tkinter.Tk(className="Productivity optimizer")
        LoginGui(root)
        root.mainloop()
开发者ID:lubosch,项目名称:productivity-classifier-linux,代码行数:56,代码来源:login_gui.py

示例11: AccountDialog

# 需要导入模块: from tkinter import Entry [as 别名]
# 或者: from tkinter.Entry import get [as 别名]
class AccountDialog(gui.tksimpledialog.Dialog):
    def __init__(self, parent, title="", login_name="", password="", path="", dx="dx11"):
        self.login_name = login_name
        self.password = password
        self.path = path
        self.dx = dx
        self.entry_ln = None
        self.variable = None
        self.entry_pw = None
        self.entry_path = None
        self.entry_dx = None
        super().__init__(parent, title)

    def body(self, master):
        Label(master, text="Login Name:").grid(row=0)
        Label(master, text="Password:").grid(row=1)
        Label(master, text="Eve Path:").grid(row=2)
        Label(master, text="DirectX:").grid(row=3)

        self.entry_ln = Entry(master)
        self.entry_pw = Entry(master, show="*")
        self.entry_path = Entry(master)
        self.variable = StringVar(master)
        self.variable.set(self.dx)
        self.entry_dx = OptionMenu(master, self.variable, "dx9", "dx11")

        self.entry_ln.insert(END, self.login_name)
        self.entry_pw.insert(END, self.password)
        self.entry_path.insert(END, self.path)

        # self.entry_path.bind("<FocusIn>", self.select_eve_path)

        self.entry_ln.grid(row=0, column=1)
        self.entry_pw.grid(row=1, column=1)
        self.entry_path.grid(row=2, column=1)
        self.entry_dx.grid(row=3, column=1)
        return self.entry_ln

        # def select_eve_path(self, event):

    # if event.widget == self.entry_path:
    #            self.path
    #            res = os.path.normpath(askdirectory(initialdir=self.path))
    #           self.path = res
    #            self.entry_path.insert(END, res)

    def apply(self):
        login_name = self.entry_ln.get()
        password = self.entry_pw.get()
        path = self.entry_path.get()
        dx = self.variable.get()
        self.result = [login_name, password, path, dx]
开发者ID:SpeedProg,项目名称:PveLauncher,代码行数:54,代码来源:newaccountdialog.py

示例12: Calculator

# 需要导入模块: from tkinter import Entry [as 别名]
# 或者: from tkinter.Entry import get [as 别名]
class Calculator(Frame):
    """
      The calculator has a layout like this:
      < display >
      7 8 9 *
      4 5 6 /
      1 2 3 -
      0 = + C
    """
    
    def __init__(self, parent = None):
        Frame.__init__(self, parent)
        self.make_widgets()
        self.grid()

    def make_widgets(self):
        btn_list = [
        '7', '8', '9', '*',
        '4', '5', '6', '/',
        '1', '2', '3', '-',
        '0', '=', '+', 'C']
               
        # create all buttons with a loop
        r = 1
        c = 0
        for b in btn_list:
            rel = 'ridge'
            cmd = lambda x=b: self.click(x)
            Button(self,text=b,width=7, relief = rel,command=cmd).grid(row=r,column=c)
            c += 1
            if c > 3:
                c = 0
                r += 1

        # use Entry widget for an editable display
        self.entry = Entry(self, width=33)#, bg="lightblue", fg ="blue")
        self.entry.grid(row=0, column=0, columnspan=4)

    def click(self, key):
        if key == '=':
            try:
                result = eval(self.entry.get())
                self.entry.insert(END, " = " + str(result))
            except:
                self.entry.insert(END, "--> Error!")
        elif key == 'C':
            self.entry.delete(0, END) # clear entry
        else:
        # The previous calculation has been done, so clear entry
            if '=' in self.entry.get():
                self.entry.delete(0, END)
            self.entry.insert(END, key)
开发者ID:asccharania,项目名称:learning,代码行数:54,代码来源:oop_calc_template.py

示例13: SpindleBuilderPopup

# 需要导入模块: from tkinter import Entry [as 别名]
# 或者: from tkinter.Entry import get [as 别名]
class SpindleBuilderPopup(BuilderPopup):
    """
    Class that launches a popup and collects user data to pass data back to the main window
    to build a circle.
    """
    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()

    def cleanup(self, entry=None):
        """
        Collect the data from the user and package it into object variables, then close.
        """
        center = complex(0, 0)
        try:
            if self.center_entry.get():
                #only ingest the center if it is passed by the user
                center = complex(allow_constants(self.center_entry.get()))
            n_circles = int(self.n_circles_entry.get())
            #this is the data that the passed builder function requires
            self.data = (int(self.spindles_entry.get()), 
                         float(allow_constants(self.radius_entry.get())), n_circles, center)
        except Exception:
            #Invalid entry data... eventually log this
            pass
        self.top.destroy()
开发者ID:SamuelDoud,项目名称:complex-homotopy,代码行数:53,代码来源:BuilderWindows.py

示例14: AddManually

# 需要导入模块: from tkinter import Entry [as 别名]
# 或者: from tkinter.Entry import get [as 别名]
class AddManually(Frame):

    def __init__(self, parent, controller):
        Frame.__init__(self, parent)
        self.controller = controller

        self.place(relx=0.0, rely=0.0, relheight=0.62, relwidth=0.72)
        self.configure(relief=GROOVE)
        self.configure(borderwidth="2")
        self.configure(relief=GROOVE)
        self.configure(width=125)

        self.label_top = Label(self)
        self.label_top.place(relx=0.4, rely=0.03, height=21, width=112)
        self.label_top.configure(text="Add items manually")

        self.name = Entry(self, fg='grey')
        self.name.place(relx=0.05, rely=0.31, relheight=0.08, relwidth=0.29)
        self.name.insert(0, "Input name here")
        self.name.bind('<Button-1>', lambda event: greytext(self.name))

        self.link = Entry(self, fg='grey')
        self.link.place(relx=0.65, rely=0.31, relheight=0.08, relwidth=0.29)
        self.link.insert(0, "Input link here")
        self.link.bind('<Button-1>', lambda event: greytext(self.link))

        self.add_btn = Button(self, command=self.send_data)
        self.add_btn.place(relx=0.42, rely=0.44, height=34, width=100)
        self.add_btn.configure(text="Add item")

        self.back = Button(self, command=lambda: controller.show_frame('Main'))
        self.back.place(relx=0.42, rely=0.64, height=34, width=100)
        self.back.configure(text="Go back")

        name_label = Label(self)
        name_label.place(relx=0.05, rely=0.22, height=21, width=38)
        name_label.configure(text="Name")

        link_label = Label(self)
        link_label.place(relx=0.65, rely=0.22, height=21, width=28)
        link_label.configure(text="Link")

    def send_data(self):
        if self.link.cget('fg') == 'grey' or self.name.cget('fg') == 'grey':
            return
        link = self.link.get()
        if link.strip() != '':
            name = self.name.get()
            self.controller.add_item(link, name)
            print("Item added")
开发者ID:s0hvaperuna,项目名称:Custom-playlist,代码行数:52,代码来源:addlink.py

示例15: Add_Mod_Modal

# 需要导入模块: from tkinter import Entry [as 别名]
# 或者: from tkinter.Entry import get [as 别名]
class Add_Mod_Modal(Modal):
    def __init__(self, parent=None, title="Add Mod"):
        Modal.__init__(self, parent, title, geometry="675x150" if system() == "Windows" else "525x135")

    def initialize(self):
        short_name_label = Label(self, font=("TkTextFont", 13), text="Short Name: ")
        short_name_label.grid(row=0, column=0, pady=10, padx=10)

        self.short_name_box = Entry(self, font=("TkTextFont", 13), width=15)
        self.short_name_box.focus_set()
        self.short_name_box.grid(row=0, column=1, pady=10)

        long_name_label = Label(self, font=("TkTextFont", 13), text="Long Name: ")
        long_name_label.grid(row=1, column=0, pady=5, padx=10)

        self.long_name_box = Entry(self, font=("TkTextFont", 13), width=35)
        self.long_name_box.grid(row=1, column=1, pady=5)

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

        open_button = Button(self, text="Open...", width=10, command=self.open)
        open_button.grid(row=2, column=1, pady=10)

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

    def ok(self, event=None):
        sn = self.short_name_box.get()
        ln = self.long_name_box.get()
        if sn != "" and ln != "":
            self.short_name = sn
            self.long_name = ln
            self.destroy()

    def open(self, event=None):
        self.short_name = "open"
        self.long_name = "open"
        self.destroy()

    def cancel(self, event=None):
        self.short_name = None
        self.long_name = None
        self.destroy()

    def show(self):
        Modal.show(self)
        return (self.short_name, self.long_name)
开发者ID:nalexander50,项目名称:MCRC-JSON-Creator,代码行数:52,代码来源:Add_Mod_Modal.py


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