a question about tkinter StringVars()

William Gill noreply at gcgroup.net
Wed Aug 24 11:07:27 EDT 2005


Working with tkinter, I have a createWidgets() method in a class.
Within createWidgets() I create several StringVars() and
assign them to the textvariable option of several widgets.
Effectively my code structure is:

def createWidgets(self):
     ...
     var = StringVar()
     Entry(master,textvariable=var)
     ...
     ...

Though 'var' would normally go out of scope when createWidgets 
completes, since the Entry and its reference do not go out of scope, 
only the name 'var' goes out of scope, not the StringVar object, Right?

Thanks,
Bill



More information about the Python-list mailing list