Tk -- stupid blank dialog opens up in background

Fredrik Lundh fredrik at pythonware.com
Sat Dec 13 06:30:21 EST 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
proceeding:

    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

</F>








More information about the Python-list mailing list