I can't get value of entry box, Tinker

7stud bbxx789_05ss at yahoo.com
Fri Aug 24 20:28:09 CEST 2007


Matt McCredie wrote:
> > What/should I, can I do?
>
> Fix your code?
>
> > def login():
> >     global e2,e1
> >     print e2.get()
> >     print e1.get()
>
> That should work.
>
> Matt

Try something like this:

import Tkinter as tk

root = tk.Tk()
entry = tk.Entry(root)
button = tk.Button(root, text="print text in textbox")

def on_button_click(event):
    print entry.get()

button.bind("<Button-1>", on_button_click)

entry.pack()
button.pack()
root.mainloop()




More information about the Python-list mailing list