[Tutor] Misunderstanding the Entry Widget

Alan Gauld alan.gauld at btinternet.com
Sun Mar 8 10:11:58 CET 2009

"Wayne Watson" <sierra_mtnview at sbcglobal.net> wrote

> Signature.htmlAnother thought occurred to me about this situation.
> Suppose I have a dialog with two Entry objects in a dialog object 
> called TwoEntries:
>    entry1 = Entry(master, width=10).grid(row=4, column=1)
>    entry2 = Entry(master, width=10).grid(row=5, column=1)
> and I do not use a StringVar to return the values entered.
> Is it possible to reach inside TwoEntries, after returning from it,
> and grab entry1 and 2? It would seem so if the call was 
> dialog=TwoEntries(...).

Sure, just use

x = dialog.entry1.get()
y = dialog.entry2.get()

There really is nothing special going on.

>  I have no idea of the history of these variables, but they have
> very limited descriptions and examples.

I assume because they have a very simple and specific purpose.
There is probably more on them if you look at the original Tcl/Tk
documentation. Remember Tkinter is just a wrapper arpund Tcl/Tkl
and Tk has been around for a long time (20 years now)

Alan G. 

More information about the Tutor mailing list