Sorry, disregard my previously incompleted message.
Roger Binns writes:
The new Bind stuff also baffles me. I don't see *ANY*
benefit to changing my existing code to use it.
I love the new Bind because it correctly states the action
(Bind) being made by the object, and the parameters
are what event we are binding and who is receiving the
event. IOW, the parameters are the two ends of the
connection. Much much cleaner, although admittedly the
result is the same and the line isn't much shorter.
Also, the id optional parameters are at the end, and
aren't even usually needed, so most binds can look like:
checkbox.Bind(wx.EVT_CHECKBOX, frame.onSexToggle)
The checkbox's event is getting bound to the frame's
method, and that is readily apparent by the cleaner syntax.
One thing that baffles me is the following in the docstring:
Bind(self, event, handler, source=None, id=-1, id2=-1)
> Bind an event to an event handler.
>
> event One of the EVT_* objects that specifies the
> type of event to bind,
>
> handler A callable object to be invoked when the event
> is delivered to self. Pass None to disconnect an
> event handler.
>
Can't an event be bound to multiple handlers, as in:
checkbox.Bind(wx.EVT_CHECKBOX, frame.method1)
checkbox.Bind(wx.EVT_CHECKBOX, frame.method2)
At which point:
checkbox.Bind(wx.EVT_CHECKBOX, None)
has exactly what effect? Does it unbind both?
I'd like to see something much more explicit, as in:
checkbox.UnBind(wx.EVT_CHECKBOX, frame.method1)
... and that would raise an exception if not previously bound.
···
--
Paul