[Tutor] How to pass multiple variables in callback function?
alan.gauld at btinternet.com
Wed Dec 6 00:26:22 CET 2006
"Asrarahmed Kadri" <ajkadri at googlemail.com> wrote
> I mean to say that suppose I have two lists, and I want to pass them
> to the
> event handling function. Is that possible using bind?
Not answering your question directly but you can do
it with a lambda expression.
# the func I want to use
foo = lambda p1=list1, p2=list2: myfunc(p1,p2)
bind(e,lambda p1=list1, p2=list2: myfunc(p1,p2))
Obviously(?) list1 and list2 need to be in the same scope as
the lambda expression!
Author of the Learn to Program web site
More information about the Tutor