tkinter questions: behavior of StringVar, etc

John Posner jjposner at
Mon Mar 30 18:25:38 CEST 2009

Eric Brunel said:

 >> The Tk instance is registered in a hidden variable in the 
 >> Tkinter module. When
 >> 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 create
 >> several Tk instances in the same application.

Again, "latest" is incorrect for IDLE 2.6.1:

    >>> from Tkinter import *
    >>> root1 = Tk()
    >>> root2 = Tk()
    >>> root3 = Tk()
    >>> frm = Frame()       # no master specified
    >>> frm.master is root3
    >>> frm.master is root1

 >> Well, I personnally don't see any point on doing any master creation
 >> implicitely, so I never use this master auto-creation for 
 >> anything.

+1. "Explicit is better than implicit."


E-mail message checked by Spyware Doctor (
Database version: 5.12070

More information about the Python-list mailing list