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?
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