Hi all,
I'm trying to re-work FloatCanvas to use PyEventBinder objects.
I did have this:
EVT_FC_MOTION = wx.NewEventType()
def EVT_MOTION( window, function ):
window.Connect( -1, -1,EVT_FC_MOTION , function )
Which I replaced by this:
EVT_MOTION = wx.PyEventBinder(EVT_FC_MOTION, 1)
now the Bind() method works:
self.Canvas.Bind(FloatCanvas.EVT_MOTION, self.OnMove)
However, all my old code bound methods this way:
FloatCanvas.EVT_MOTION(self.Canvas, self.OnMove )
In theory, the new PyEventBinder object should have a __call__ method that supports the old way. However, it seems want an id parameter:
Traceback (most recent call last):
...
FloatCanvas.EVT_MOTION(self.Canvas, self.OnMove )
File "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", line 3688, in __call__
assert len(args) == 2 + self.expectedIDs
looking at the docs, I see:
__call__(self, *args)
(Call operator)
For backwards compatibility with the old EVT_* functions. Should be called with either (window, func), (window, ID, func) or (window, ID1, ID2, func) parameters depending on the type of the event.
I'm trying to use the (window, func) method, but it's not working, which makes me think I've got the wrong kind of event (command vs. non-command), but I don't know how to get an event besides:
wx.NewEventType()
So what can I do to get the old EVT_** API back, while updating?
I'm happy using bind() myself, but I'd rather not break all my old code, plus every other users!
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception