Tkinter dialog boxes

vivek kumar gupt_vive at hotmail.com
Sat Jun 21 03:24:22 EDT 2003


>From: "Tony Evreshed" <tony_evershed at yahoo.co.uk>

>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 
>with
>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 
parameter
    def __init__(self,parent):
        self.parent=parent

        #create a top level windows that will hold other widgets in it
        top=self.top=Toplevel(parent)

        #make the widget a child widget of the parent
        self.top.transient(parent)

        #create other widgets on the top level widget
         ........................

        #set the initial focus on whatever widget of this widget you want
        self.myTextWidget.focus_set()

        #get the focus for the top level widget
        self.top.grab_set()


Hope that this is of some help to you.

Regards
Vivek Kumar

_________________________________________________________________
Smile a little. Enjoy the summer with Joggers' Park! 
http://server1.msn.co.in/sp03/joggerspark/index.asp






More information about the Python-list mailing list