Next / Previous / Contents / Shipman's homepage

12.21. MenuBar.__dialog(): Pop up a dialog widget

This method creates a pop-up Dialog widget. The structure is the same except for the frame title (the title argument) and the help text (the text argument).

# - - -   M e n u B a r . _ _ d i a l o g

    def __dialog ( self, title, text ):
        """Pop up a Dialog widget.

          [ (title is the frame title as a string) and
            (text is the help text as a multiline string containing
            newlines and tab characters) ->
              desktop  :=  desktop with a Dialog widget displaying
                  title and text ]

The Dialog widget for pop-up menus comes from the module, part of Tkinter. Unfortunately, this widget is poorly documented; the author learned to use it by reading examples and reading its source code.

        Dialog ( self, default=0, strings=('Dismiss',), bitmap='info',
                 title=title, text=text )

One drawback of these prefabricated Dialog widgets is that you can't override the ugly font. This is a candidate for replacement someday. Note that the widget grabs the focus, so the user can't do anything back in the main window until they dismiss the pop-up.