User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 456,274 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,271 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums
Views: 1345 | Replies: 2
Reply
Join Date: Mar 2007
Posts: 1,449
Reputation: Lardmeister is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 8
Lardmeister's Avatar
Lardmeister Lardmeister is offline Offline
Nearly a Posting Virtuoso

Animated Images

  #1  
Aug 3rd, 2007
Can I display animated images like an animated GIF file using Python code?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Posts: 1,196
Reputation: Ene Uran is on a distinguished road 
Rep Power: 6
Solved Threads: 67
Ene Uran's Avatar
Ene Uran Ene Uran is offline Offline
Veteran Poster

Re: Animated Images

  #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
File Type: gif AG_puppy.gif (6.3 KB, 18 views)
drink her pretty
Reply With Quote  
Join Date: Mar 2007
Posts: 1,449
Reputation: Lardmeister is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 8
Lardmeister's Avatar
Lardmeister Lardmeister is offline Offline
Nearly a Posting Virtuoso

Re: Animated Images

  #3  
Aug 20th, 2007
Thank you Miss Ene, that works great!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Python Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Python Forum

All times are GMT -4. The time now is 6:39 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC