Discussion:
[Tkinter-discuss] [Tutor] tkinter binding issues
Wayne Werner
2011-10-20 20:11:37 UTC
Permalink
Forwarding to the list...
Thank you very much. That was a great help. I briefly considered the
lambda idea, but since I really don't understand the whole lambda thing (I
used an explanation from effbot for my buttons...but didn't really know
what I was doing) ... didn't even attempt it. The one that was really
driving me crazy was the clear form thing. I tried your idea of changing
the focus before calling the tkmessagebox. Worked like a champ!
Lambdas are quite nice - they let you create a single, one line function
with minimal effort.

def add(x, y):
return x + y

add2 = lambda x, y: x + y

add(2, 3) # Returns 5
add2(2, 3) # Also returns 5

I highly recommend firing up your interpreter and playing around with lambda
functions. There are only a few places that they're appropriate, but they
make those few things a _lot_ easier.

HTH,
Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20111020/ebdca28e/attachment.html>
Loading...