newbie with major "lambda" problem (perhaps a scope problem as well)

Rainer Deyke root at rainerdeyke.com
Tue Jun 26 18:09:06 CEST 2001


"Joe Potter" <jm7potter at hotmail.com> wrote in message
news:j5ahjtkfmf32lkqtap0q1u6rig385d7b5i at 4ax.com...
>     # the "button" below works like a champ !!
>     #Button(root, text='Fetch',
>                  #command=(lambda v=vars: fetch(v))).pack(side=LEFT)
>
>     # the "button" below does not do anything ??????
>     Button(root, text='Fetch', command=(fetch(vars))).pack(side=LEFT)

Of course this doesn't work.  It calls 'fetch(vars)', and passes the result
to 'Button'.  Use the lambda, that's what it's there for.  Or use one of the
'curry' alternatives (see archives).


--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor





More information about the Python-list mailing list