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

Rainer Deyke root at
Tue Jun 26 12:09:06 EDT 2001

"Joe Potter" <jm7potter at> wrote in message
news:j5ahjtkfmf32lkqtap0q1u6rig385d7b5i at
>     # 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
Shareware computer games           - 
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor

More information about the Python-list mailing list