Can't get wxAnimationCtrl to work

96 views
Skip to first unread message

BigPilot

unread,
Mar 17, 2010, 3:04:06 AM3/17/10
to wxPython-users
Hi,

I'm using wxAnimationCtrl in my Python program but can't get it to
work.

<object class="wxAnimationCtrl" name="AnimationCtrl">
<style>wxAC_DEFAULT_STYLE</style>
<animation></animation>

self.animation = xrc.XRCCTRL( self.loginpanel, "AnimationCtrl" )
self.animation.LoadFile( "loading.gif", wx.ANIMATION_TYPE_GIF )
self.animation.Play()

I get the following error:

self.animation.LoadFile( "loading.gif", wx.ANIMATION_TYPE_GIF )
AttributeError: 'Control' object has no attribute 'LoadFile'

Looking in the docs I find AnimationCtrl is derived from
AnimationCtrlBase which contains the LoadFile() method. Ergo, it
should work.

Anyone used AnimationCtrl with wxPython and XRC?

Robin Dunn

unread,
Mar 17, 2010, 1:24:10 PM3/17/10
to wxpytho...@googlegroups.com

You need to import wx.animate in your Python code, so wxPython knows
about the wx.animate.AnimationCtrl proxy class. Once it has loaded the
class (and some type information about it) then wxPython will be able to
wrap an instance of the proxy class around the wx.Window pointer
returned by XRCCTRL. Otherwise wxPython has to go up the class
hierarchy until it finds a class that it does know about, in this case
it was wx.Control.


--
Robin Dunn
Software Craftsman
http://wxPython.org

BigPilot

unread,
Mar 17, 2010, 2:08:34 PM3/17/10
to wxPython-users
Thanks Robin, got it working!
Reply all
Reply to author
Forward
0 new messages