Re: [Tutor] tkinter binding issues

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [Tutor] tkinter binding issues

Wayne Werner
Forwarding to the list...

On Thu, Oct 20, 2011 at 9:06 AM, Elwin Estle <[hidden email]> 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.

HTH,
Wayne

_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss