Tk -- stupid blank dialog opens up in background

B

bmgz

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?
 
F

Fredrik Lundh

bmgz said:
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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top