Tkinter dialog boxes

vivek kumar gupt_vive at
Sat Jun 21 09:24:22 CEST 2003

>From: "Tony Evreshed" <tony_evershed at>

>I've been using the tkMessageBox in Python to create small dialogs to
>instruct the user in what to do next, and I've noticed that the boxed are
>alays 'on top' of the screen - that is, it's not possible to cover them 
>another window.
>Is there any way to do this with dialogs created in this way?
>If not, how should I create dialogs that correspond to the askyesno and
>showinfo dialogs but can also have other windows in top of them?

If this means that you want a dialog that will be on top of its application 
and not on top systemwide then the following code may help you.

#dialog class
class myDialog:

    #class constructer takes the master widget instance reference as 
    def __init__(self,parent):

        #create a top level windows that will hold other widgets in it

        #make the widget a child widget of the parent

        #create other widgets on the top level widget

        #set the initial focus on whatever widget of this widget you want

        #get the focus for the top level widget

Hope that this is of some help to you.

Vivek Kumar

Smile a little. Enjoy the summer with Joggers' Park!

More information about the Python-list mailing list