pyglet and animated gif

Posted by wtzolt on Stack Overflow See other posts from Stack Overflow or by wtzolt
Published on 2010-04-12T01:05:11Z Indexed on 2010/04/12 1:13 UTC
Read the original article Hit count: 719

Filed under:
|

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()

© Stack Overflow or respective owner

Related posts about python

Related posts about pyglet