| 1 | |
| 2 | import wx |
| 3 | from wx.animate import GIFAnimationCtrl |
| 4 | |
| 5 | from Main import opj |
| 6 | |
| 7 | GIFNames = [ |
| 8 | "bitmaps/ani-bttrfly.gif", |
| 9 | "bitmaps/ani-avtr.gif", |
| 10 | "bitmaps/ani-phone.gif", |
| 11 | # "bitmaps/ani-walker.gif", |
| 12 | "bitmaps/ani-man.gif", |
| 13 | "bitmaps/ani-bookworm.gif", |
| 14 | "bitmaps/ani-hooked.gif", |
| 15 | ] |
| 16 | |
| 17 | #---------------------------------------------------------------------- |
| 18 | |
| 19 | class TestPanel(wx.Panel): |
| 20 | def __init__(self, parent, log): |
| 21 | self.log = log |
| 22 | wx.Panel.__init__(self, parent, -1) |
| 23 | |
| 24 | sizer = wx.FlexGridSizer(2,3,5,5) |
| 25 | for name in GIFNames: |
| 26 | ani = GIFAnimationCtrl(self, -1, opj(name)) |
| 27 | ani.GetPlayer().UseBackgroundColour(True) |
| 28 | ani.Play() |
| 29 | sizer.Add(ani, 0, wx.ALL, 10) |
| 30 | |
| 31 | border = wx.BoxSizer() |
| 32 | border.Add(sizer, 1, wx.EXPAND|wx.ALL, 20) |
| 33 | self.SetSizer(border) |
| 34 | |
| 35 | |
| 36 | #---------------------------------------------------------------------- |
| 37 | |
| 38 | def runTest(frame, nb, log): |
| 39 | win = TestPanel(nb, log) |
| 40 | return win |
| 41 | |
| 42 | #---------------------------------------------------------------------- |
| 43 | |
| 44 | |
| 45 | |
| 46 | overview = """<html><body> |
| 47 | <h2><center>wx.animate.GIFAnimationCtrl</center></h2> |
| 48 | |
| 49 | wx.animate.GIFAnimationCtrl is like a wx.StaticBitmap but is able to |
| 50 | display an animation by extracing frames from a multi-images GIF file. |
| 51 | |
| 52 | </body></html> |
| 53 | """ |
| 54 | |
| 55 | |
| 56 | |
| 57 | if __name__ == '__main__': |
| 58 | import sys,os |
| 59 | import run |
| 60 | run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:]) |
| 61 | |