TK entry pretext
eric.brunel at pragmadev.com
Wed Jan 29 10:02:59 CET 2003
> Im having trouble with the Entry code in TK
> Q1 can I put some pre text in the entry box?. How?
There are two ways to do that:
self.e_fanon=Entry(frame, width=5, text="default value")
This is not the best way...
2/ use a Tkinter string variable:
myVar = StringVar()
self.e_fanon=Entry(frame, width=5, textvariable=myVar)
This is the preffered way, since from now, every change made by the user in the
entry will be reflected in myVar. To get the current value in the entry, just do
> Q2 how do I know when/if to get the users entry?
> does Python/tk set a flag.
The when or if is up to you. It's usually when a "OK" button is clicked or when
a "File"/"Save" menu item is chosen or whatever. I can always react to any
keypress in the entry, but I don't think this is what you want...
- Eric Brunel <eric.brunel at pragmadev.com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
More information about the Python-list