[Tkinter-discuss] Attaching Widget Var to Widget?
Lion Kimbro
lionkimbro at gmail.com
Sun Nov 4 22:39:50 CET 2012
I'm trying to minimize maintenance of Var values. It is irritating that there is no method to get the check state of a Checkbutton, like there is to get the content of an Entry (.get).
There is much out there on using the variable= parameter out there, but little on strategies for maintaining the variables.
Are there any known problems with simply attaching a StringVar or IntVar to the Python widget it comes with?
Ex:
var=IntVar()
chk=Checkbutton(frame, text="label", variable=var)
chk.var=var
Will there be any allocation/deal location problems with this?
If the widget is destroyed via a grandparent or something, will any resources be left dangling? Anyone have any experience with this?
I notice in the tk docs that a default variable is created if you don't make one yourself, and I am considering creating a StringVar using the name parameter such that it matches by querying the full path from the ID of the widget.
More information about the Tkinter-discuss
mailing list