[Tkinter-discuss] [Tutor] tkinter binding issues

Wayne Werner waynejwerner at gmail.com
Thu Oct 20 22:11:37 CEST 2011

Forwarding to the list...

On Thu, Oct 20, 2011 at 9:06 AM, Elwin Estle <chrysalis_reborn at yahoo.com>wrote:

> 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.

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

More information about the Tkinter-discuss mailing list