Question about Tkinter message boxes

Graham Ashton graz at mindless.com
Fri Oct 26 12:50:34 CEST 2001


In article <3B7D5BA4.69A8C2EC at earthlink.net>, "Joseph Andrew Knapka"
<jknapka at earthlink.net> wrote:

> Mike Callahan wrote:
>> 
>> When I run this code:
>> 
>> import tkMessageBox as tkM
>> tkM.showerror('Error', 'Test messgage')
>> 
>> I get two windows. A blank Tk box and the error box. When I click on OK
>> in the error box, the blank Tk box remains. How do I keep the blank Tk
>> box from appearing?
>> 
>> Mike Callahan
> 
> Tk will always create a root window whether you want one or not. You can
> create it explicitly and then hide it at the beginning of your program:
> 
> root = Tkinter.Tk()
> root.withdraw()

Have you tried this:

from Tkinter import *
NoDefaultRoot()

--
Graham



More information about the Python-list mailing list