[wxPython-users] Bind arguments
Robin Dunn
robin at alldunn.com
Mon Mar 17 17:51:05 PDT 2008
Cody Precord wrote:
> Hello,
>
> On Mar 16, 2008, at 12:53 PM, Matt Webster wrote:
>
>>
>> After fooling around for a few hours with this, I'm getting to the
>> point where I believe the Bind() doesn't allow functions with
>> arguments. Every example I've pulled on the web supports this but so
>> far I haven't found any docs that say this too.
>>
> Using lambda functions should do what you want.
>
> self.Bind(wx.EVT_BUTTON, lambda evt: self.OnShow(evt, '7'), id=1)
Also take a look at the recipes in the Python Cookbook for "curry" such
as http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52549
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list