pyGTK -- how to wait for modal dialog?

Grant Edwards ge at nowhere.none
Wed Oct 11 12:19:30 EDT 2000


In article <nK%E5.245$FU3.30895 at ptah.visi.com>, Grant Edwards wrote:

>I've created a modal dialog box, but can't figure out how to
>wait until the dialog is dismissed so I can find out which
>button was pressed.

Here's what I've figured out so far (it seems to work), is it
the recommended idiom?

class FooBar(GtkDialog):
    __super = GtkDialog
    def __init__(self,msg,buttonTextList):
        self.__super.__init__(self)
        self.__returnString = None
        self.set_modal(TRUE)
        [...]
        
    def clicked(self,buttonWidget,buttonText):
        self.__returnString = buttonText
        self.destroy()
    
    def wait(self):
        while self.__returnString is None:
            mainitereation()
        return self.__returnString

The important thing is that mainiteration blocks until it
receives an event -- this is the default behavior.

-- 
Grant Edwards                   grante             Yow!  Mr and Mrs PED, can I
                                  at               borrow 26.7% of the RAYON
                               visi.com            TEXTILE production of the
                                                   INDONESIAN archipelago?



More information about the Python-list mailing list