Friday, April 9, 2010

Tips: wx.Python: Animated Gif in

import wx

import wx.animate # ..\wx\animate.py

class MyPanel(wx.Panel):

""" class MyPanel creates a panel, inherits wx.Panel """

def __init__(self, parent=None):


wx.Panel.__init__(self, parent)


self.SetBackgroundColour("white")


ag_fname = r"progress.gif"


self.ag = wx.animate.GIFAnimationCtrl(self, -1, ag_fname, pos=(0, 0), size=(64,64))


self.ag.GetPlayer().UseBackgroundColour(True)


self.ag.Play()


#self.ag.Stop()



if __name__ == '__main__':

app = wx.App(redirect = 0)


frame = MyPanel(None)


frame.Show(True)


app.SetTopWindow(frame)


app.MainLoop()


No comments: