[IronPython] Can't install IronPython Tools for Visual Studio
Dino Viehland
dinov at microsoft.com
Mon May 3 19:34:16 CEST 2010
Lukáš Duběda wrote:
> Thanks for pointing that out, Curt,
>
> now, for such a trivial function I can imagine substituting
> it with a Lambda, however, how would I use a more complex
> function?
>
> I found out exactly that when not passing any arguments
> the function works like this:
>
> def functName(self, sender):
> ....
> pass
>
> (XamlDef.FindName('btnCreate')).Click += functName
>
>
> This has worked flawlessly, as soon as I need to pass it
> an argument. I haven't found a way to do that.
You can always just create a closure:
def outer_lambda(...):
foo = 42
def functName(self, sender):
print foo
(XamlDef.FindName('btnCreate')).Click += functName
More information about the Ironpython-users
mailing list