Why can't I add a timer to an ogl.BitmapShape ?

If I try to define a timer in an ogl.BitmapShape, like this:

class T6963_device (ogl.BitmapShape):
  def __init__(self):
    ogl.BitmapShape.__init__ (self)
    self.t1 = wx.Timer (self)

I get this error

Traceback (most recent call last):
  File "D:\data_to_test\smtest2.py", line 516, in ?
    LCD_init ( frame )
  File "D:\data_to_test\T6963c.py", line 337, in LCD_init
    LCD = T6963_device()
  File "D:\data_to_test\T6963c.py", line 107, in __init__
    self.t1 = wx.Timer (self)
  File "P:\Python\Lib\site-packages\wx-2.8-msw-ansi\wx\_misc.py", line 1279, in __init__
    _misc_.Timer_swiginit(self,_misc_.new_Timer(*args, **kwargs))
TypeError: in method 'new_Timer', expected argument 1 of type 'wxEvtHandler *'

If I add the same timer definition to my main form, like this

class My_MainForm(wx.Frame):
  def __init__(self):
    wx.Frame.__init__( self, None, -1, 'JAL Functional Simulator' ,
                       pos=(0,0), size=(640,480))

    # Finally show the mainform
    self.Show()

    self.t1 = wx.Timer (self)
    self.Bind(wx.EVT_TIMER, self.OnTimer)
    self.t1.Start ( 1000 )

  def OnTimer (self, event):
    print 'aap'

everything works perfect.

Why can't I define a timer in an ogl.BitmapShape ?
In which (derived) objects can I define a Timer ?

thanks,
Stef Mientki

Because ogl.BitmapShape is not a subclass of wx.EvtHandler

···

Am 09.06.2007, 21:00 Uhr, schrieb Stef Mientki <s.mientki@ru.nl>:

If I try to define a timer in an ogl.BitmapShape, like this:

class T6963_device (ogl.BitmapShape):
  def __init__(self):
    ogl.BitmapShape.__init__ (self)
    self.t1 = wx.Timer (self)

I get this error

Traceback (most recent call last):
  File "D:\data_to_test\smtest2.py", line 516, in ?
    LCD_init ( frame )
  File "D:\data_to_test\T6963c.py", line 337, in LCD_init
    LCD = T6963_device()
  File "D:\data_to_test\T6963c.py", line 107, in __init__
    self.t1 = wx.Timer (self)
  File "P:\Python\Lib\site-packages\wx-2.8-msw-ansi\wx\_misc.py", line 1279, in __init__
    _misc_.Timer_swiginit(self,_misc_.new_Timer(*args, **kwargs))
TypeError: in method 'new_Timer', expected argument 1 of type 'wxEvtHandler *'

If I try to define a timer in an ogl.BitmapShape, like this:

class T6963_device (ogl.BitmapShape):
  def __init__(self):
    ogl.BitmapShape.__init__ (self)
    self.t1 = wx.Timer (self)

I get this error

Because ogl.BitmapShape is not a subclass of wx.EvtHandler

Thanks.

I now fetch the event from the container at it works great.

But now I've a new problem,
so I'll write a new mail :wink:

cheers,
Stef Mientki