Fwd: I can't get value of entry box, Tinker

Lamonte Harris pyth0nc0d3r at gmail.com
Fri Aug 24 14:49:55 EDT 2007


yes, I already fixed the problem.

---------- Forwarded message ----------
From: 7stud <bbxx789_05ss at yahoo.com>
Date: Aug 24, 2007 1:28 PM
Subject: Re: I can't get value of entry box, Tinker
To: python-list at python.org

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()

--
http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070824/fac715f9/attachment.html>


More information about the Python-list mailing list