| | |
wxPython Animated Gif
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Version 2.6 of wxPython has support for playing animated gif image files. The example sets up a panel on a frame and then uses wx.animate.GIFAnimationCtrl() to do the hard work. Actually pretty simple code.
# display an animated GIF image file using wxPython # tested with Python24 and wxPython26 vegaseat 22nov2005 import wx import wx.animate # ..\wx\animate.py class MyPanel(wx.Panel): """ class MyPanel creates a panel, inherits wx.Panel """ def __init__(self, parent, id): # default pos and size creates a panel that fills the frame wx.Panel.__init__(self, parent, id) self.SetBackgroundColour("white") # pick the filename of an animated GIF file you have ... # give it the full path and file name! ag_fname = "D:/Python24/Atest/wx/AG_Dog.gif" ag = wx.animate.GIFAnimationCtrl(self, id, ag_fname, pos=(10, 10)) # clears the background ag.GetPlayer().UseBackgroundColour(True) # continuously loop through the frames of the gif file (default) ag.Play() app = wx.PySimpleApp() # create a window/frame, no parent, -1 is default ID # give it a size so the image will fit ... frame = wx.Frame(None, -1, "wx.animate.GIFAnimationCtrl()", size = (500, 400)) # call the derived class, -1 is default ID MyPanel(frame, -1) # show the frame frame.Show(True) # start the event loop app.MainLoop()
Similar Threads
- [saving animated GIF] Help... (VB.NET)
- animated gif (DaniWeb Community Feedback)
- Animated gif in picturebox (C#)
- can i use animated gif? (Visual Basic 4 / 5 / 6)
- Animated GIF files (Python)
| Thread Tools | Search this Thread |
advanced aliased bash beginner bits calling casino changecolor class clear command convert corners count csv cturtle cursor def definedlines dictionary digital dynamic dynamically events examples external file float format frange function google gui hints homework i/o iframe import info input java line linux list lists loop matching mouse multiple number numbers obexftp output parsing path port prime programming projects py py2exe pygame pygtk python random rational raw_input recursion return scrolledtext signal singleton skinning stderr string strings subprocess table tails terminal text thread threading time tkinter tlapse tuple tutorial ubuntu unicode urllib urllib2 valueerror variable voip web-scrape whileloop windows word wxpython



