tkinter questions: behavior of StringVar, etc
eric.brunel at nospam-pragmadev.com
Mon Mar 30 16:45:36 CEST 2009
Alan G Isaac wrote:
> On 3/30/2009 3:37 AM Eric Brunel apparently wrote:
>> The Tk instance is registered in a hidden variable in the Tkinter module.
>> you don't specify a master, it'll use the latest created Tk instance one by
>> default. BTW, the latest should be the only one: it is quite unsafe to
>> several Tk instances in the same application.
> I have no desire to do this, but might you pin down "unsafe"?
It is not supposed to be unsafe at tcl level, as it supports several
interpreters side by side in the same application. It is unsafe at user level,
precisely because creating a StringVar might put it in the interpreter you
don't want, leading to weird errors and unexpected results.
So you *can* use several Tk instances in the same application, but then you
really should specify a master for absolutely everything, or you'll get bitten
at some point.
> Alan Isaac
- Eric -
More information about the Python-list