Tk -- stupid blank dialog opens up in background

Fredrik Lundh fredrik at
Sat Dec 13 12:30:21 CET 2003

"bmgz" <bmgz at dev.null> wrote:

> I am just starting with python, I found it anoying that when I use Tk, a
> blank dialog always opens up behind tkMessageBox or whatever other gui
> element one executes.. Is their a way of disabling this?

the "blank dialog" is Tkinter's root window.

to eliminate that, explicitly create a root and withdraw it before

    root = Tkinter.Tk()
    root.withdraw() # won't need this

if you're building a full-blown Tkinter application, the usual approach is
to put your widgets in the root window:

    root = Tkinter.Tk()

    mybutton = Button(root, text=...)
    mybutton.pack() # etc


More information about the Python-list mailing list