pyglet and animated gif
- by wtzolt
Hello,
I have a message box pop up when a certain operation is being executed sort of "wait..." window and I want to have a "loading" *.gif animation there to lighten up the mood :)
Anyways I can't seem to figure out how to make this work. It's a complete mess. I tried calling through class but i get loads of errors to do with pyglet itself.
class messageBox:
def __init__(self, lbl_msg = 'Message here', dlg_title = ''):
self.wTree = gtk.glade.XML('msgbox.glade')
self.wTree.get_widget('label1').set_text(lbl_msg)
self.wTree.get_widget('dialog1').set_title(dlg_title)
????sprite = pyglet.sprite.Sprite(pyglet.resource.animation("wait.gif"))
????self.wTree.get_widget('waitt').set_from_file(sprite)
[email protected]
????def on_draw():
???? win.clear()
???? sprite.draw()
handlers = { 'on_okbutton1_clicked':self.gg }
self.wTree.signal_autoconnect( handlers )
self.wTree.get_widget("dialog1").set_keep_above(True)
def done(self):
self.wTree.get_widget('dialog1').destroy()
def gg(self,w):
self.wTree.get_widget('dialog1').destroy()
---------
@yieldsleep
def popup(self, widget, data=None):
self.msg = messageBox('Wait...','')
?what to call here?
yield 500
print '1'
yield 500
print '2'
yield 500
print '3'
self.msg.done()
self.msg = messageBox('Done! ','')
yield 700
self.msg.done()