Animated Images

Reply

Join Date: Mar 2007
Posts: 1,521
Reputation: Lardmeister is an unknown quantity at this point 
Solved Threads: 22
Lardmeister's Avatar
Lardmeister Lardmeister is offline Offline
Posting Virtuoso

Animated Images

 
0
  #1
Aug 3rd, 2007
Can I display animated images like an animated GIF file using Python code?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 1,536
Reputation: Ene Uran has a spectacular aura about Ene Uran has a spectacular aura about 
Solved Threads: 170
Ene Uran's Avatar
Ene Uran Ene Uran is offline Offline
Posting Virtuoso

Re: Animated Images

 
0
  #2
Aug 5th, 2007
You need to use the wxPython GUI toolkit to do that:
  1. # experiment with the wx.animate.GIFAnimationCtrl() widget
  2. # needs wxPython installed
  3.  
  4. import wx
  5. import wx.animate
  6.  
  7. class AnimatedGif(wx.Panel):
  8. """class to show an animated gif image on a panel"""
  9. def __init__(self, parent, id):
  10. wx.Panel.__init__(self, parent, id)
  11. #self.SetBackgroundColour("black")
  12. # pick an animated GIF filename you have in the working folder
  13. ag_fname = "ag_puppy.gif"
  14. try:
  15. ag = wx.animate.GIFAnimationCtrl(self, id, ag_fname, pos=(10, 10))
  16. parent.SetTitle(ag_fname)
  17. except:
  18. pass
  19. ag.GetPlayer().UseBackgroundColour(True)
  20. ag.Play()
  21.  
  22.  
  23. app = wx.PySimpleApp()
  24. frame = wx.Frame(None, id=-1, title="need animated gif file", size=(300, 300))
  25. AnimatedGif(frame, id=-1)
  26. frame.Show(True)
  27. app.MainLoop()
I think something like this is in the snippets.
Attached Images
 
drink her pretty
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 1,521
Reputation: Lardmeister is an unknown quantity at this point 
Solved Threads: 22
Lardmeister's Avatar
Lardmeister Lardmeister is offline Offline
Posting Virtuoso

Re: Animated Images

 
0
  #3
Aug 20th, 2007
Thank you Miss Ene, that works great!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC