Trying to make an app for work that sends User IDs and Passwords from our server. Would like the ability to click on a "Submit" button or to just press enter at the e-mail field.This code does not work:def MakeEmail(): usernameID = UIDName.get() passwordID = PWName.get() emailAddress = EMailName.get()...EMailText = StringVar()EMailText.set("E-Mail Address")EMail1 = Label(app, textvariable=EMailText, height=4)EMail1.pack()EMail = StringVar(None)EMailName = Entry(app, textvariable=EMail, width=50)EMailName.bind("", MakeEmail) EMailName.pack()button1 = Button(app, text="Submit", width=20, command=MakeEmail)button1.pack(side='bottom',padx=15,pady=15)app.mainloop()Bind sends one argument while command sends none. How do I reconcile this?]
5/23/2012 5:40:43 PM
unplug power cord and plug it back in?
5/23/2012 6:14:01 PM
You should use the code tags to enforce indentation:
def MakeEmail(): usernameID = UIDName.get() passwordID = PWName.get() emailAddress = EMailName.get()...EMailText = StringVar()EMailText.set("E-Mail Address")EMail1 = Label(app, textvariable=EMailText, height=4)EMail1.pack()EMail = StringVar(None)EMailName = Entry(app, textvariable=EMail, width=50)EMailName.bind("", MakeEmail) EMailName.pack()button1 = Button(app, text="Submit", width=20, command=MakeEmail)button1.pack(side='bottom',padx=15,pady=15)app.mainloop()
5/23/2012 7:17:36 PM
Fuck, I'm retarded.Tkinter.
5/25/2012 4:16:55 PM
I've just started some work with Tkinter myself. I'm still new with some of the terminology, so bare with me if I give some goofy info.You can use 'lambda' to make certain sections do more. For instance, the button 'command' call can only call a function without arguments by default; however, you can use 'lambda' to get around that. For instance, you could say:
command=lambda: somefunction(arg1, arg2, arg3)
def SomeFunc(arg1, arg2, arg3="Default"):
SomeFunc(5, 1)SomeFunc(5, 1, arg3="SomethingElse")SomeFunc(arg1=5, arg2=1, arg3="SomethingElse")
5/29/2012 11:52:59 AM