[wxPython-users] Animated icons for wx notebook
Robin Dunn
robin at alldunn.com
Thu Sep 13 12:04:40 PDT 2007
Frank Aune wrote:
> Hello,
>
> Adding icons to a notebook is relatively easy:
>
> self.imglist = wx.ImageList(16,16)
> img0 = self.imglist.Add(wx.Bitmap('img.png', wx.BITMAP_TYPE_PNG))
> self.notebook.AssignImageList(self.imglist)
> self.notebook.SetPageImage(0, img0)
>
> But what if I want to (temporarily) add an animated gif image to a notebook
> page? I have the code for displaying animated gifs:
>
> self.busyIcon = wx.animate.GIFAnimationCtrl(self.frame, -1, 'animate.png')
> self.busyIcon.GetPlayer().UseBackgroundColour(True)
> self.busyIcon.Play()
>
> But so far I see no way of combining these two into what I need. Does anyone
> have experience with this kind of approach?
You'll need to do some work yourself, but it can be made to do what you
want. In a nutshell you'll need to add all the animation frames to the
image list and use a timer to change the image currently used for the
tab to the next animation frame image. You can use the Animation object
to get the frames as wx.Image objects, and also the delay between each
frame, from the image file.
P.S. When you get it working it would be nice to have a writeup about it
and some sample code in the wiki's Cookbook.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list