More decorator rumination
Scott David Daniels
Scott.Daniels at Acm.Org
Wed Mar 30 18:31:03 EST 2005
Jack Diederich wrote:
> On Wed, Mar 30, 2005 at 02:48:51PM -0800, Scott David Daniels wrote:
>>In particular, I thought about something like:
>>
>> @mousexy
>> def OnRightClick(self, x, y):
>> ...
>>
>>so all event-responding methods tend to look like:
>>
>> def OnRightClick(self, event):
>> x = event.GetX()
>> y = event.GetY()
>>
>
> It might be plainer (and certainly more backwards compatible) to
> wrap the function when setting the event handler.
>
> EVT_BUTTON(self.frame, XRCID("ButtonName"), mousexy(self.OnRightClick))
>
> As a matter of style & clairty, it just depends.
I think this is probably the right approach.
> If this is for education ...
I came here because it seemed to be drifting off-topic for education.
Thanks for the feedback.
-Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list