[Tutor] Dialog box under windows

Edward Comber comber at cix.co.uk
Fri Jan 9 03:18:48 EST 2004


Spot on, thanks very much.
Eddie.

-----Original Message-----
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org]On
Behalf Of m.evanetich at att.net
Sent: 08 January 2004 17:43
To: tutor at python.org
Subject: Re: [Tutor] Dialog box under windows


>
> On Thu, Jan 08, 2004 at 03:46:03PM -0000, Edward Comber wrote:
> > Thanks very much for that, I'll get stuck into it. At the moment it
> > opens a Tk main app screen that can't be closed but I'll persist.
>
> Not if you already have a main window open. It's not meant to be used
> standalone but as part of an application.
>
I dealt with this, thanks to suggestions on this list by writing my own
little modeule that calls these TK dialogs and withdraws the top level main
app.  Since I use these things in scripts, that seems to work pretty well.
Here is an example:

import Tkinter
import tkMessageBox
def InfoBox(Title=None, Message=None):

    root =Tkinter.Tk()
    root.withdraw()     # Prevent spurious root window from showing
    message = tkMessageBox.showinfo(title=Title, message=Message)
    root.destroy()
    return message

--
Best wishes,
mark

_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor




More information about the Tutor mailing list