[Tkinter] Entry widget and textvariable option?

Jerome Quelin jerome.quelin at insalien.org
Fri Jun 30 15:46:30 EDT 2000


Hi all,

I can't manage to use the textvariable option in an Entry widget. And
I can't find docs on this... And since we can't take references to
variables in Python, I don't see how to use this feature?

When running the following code:

>>> from Tkinter import *
>>> Entry(width=10, textvariable=spam).pack()

spam is to be defined, since Python interpolates it in the previous
statement. And that is definitely _not_ what I want Python to do! I
want the content of the Entry to go into the variable spam... In perl,
I would use '\$spam' to take a reference to the variable, and in Tcl
I'd use 'spam' to indicate a variable name, without interpolating
it. But what should I do in Python? 'spam' interpolates the content of
the spam variable, and we can't take variable references in Python...
Is it that we can't use the textvariable option in Python/Tkinter?

Any help welcome.

Thanks,
Jerome
--
jerome.quelin at insalien.org



More information about the Python-list mailing list