Noob question…
class msgbox:
def __init__(self, lbl_msg = '', dlg_title = ''):
self.wTree = gtk.glade.XML('msgbox.glade')
self.wTree.get_widget('dialog1').set_title(dlg_title)
self.wTree.get_widget('label1').set_text(lbl_msg)
self.wTree.signal_autoconnect( {'on_okbutton1_clicked':self.done} )
def done(self,w):
self.wTree.get_widget('dialog1').destroy()
class Fun(object):
wTree = None
def __init__(self):
self.wTree = gtk.glade.XML( "main.glade" )
self.wTree.signal_autoconnect( {'on_buttonOne' : self.one,} )
gtk.main()
@yieldsleep
def one(self, widget, data=None):
self.msg = msgbox('Please wait...','')
yield 500
self.msg = msgbox().done() # <----------------???
self.msg = msgbox('Done!','')
With this i get an error:
messageBox().done()
TypeError: done() takes exactly 2 arguments (1 given)
How can i make the dialog box with “please wait” to close before the second dialog box with “done” appears??
Thank you.
It looks like you want
to close the existing “Please wait…” message box.
msgbox().done()creates a new message box, then callsdoneon this new instance.As for the extra parameter, you aren’t using it, so remove it from the definition of
done:Off Topic
Class
msgboxshould inherit fromobjectso you get a new-style class.Define a destructor on
msgboxand you don’t need to explicitly callmsgbox.done, which you might forget to do.