[Tutor] Tkinter-Button class
Kent Johnson
kent37 at tds.net
Mon Mar 19 11:19:44 CET 2007
ammar azif wrote:
> Hi,
>
> Thanks for the help guys.
>
>
> I have tried gui programming using Tkinter and use the Button class
> which accepts the command argument which is a function object.
>
> The question is how to send arguments if the function accepts arguments.
A common way to do this is to use a lambda expression to bind the
arguments, e.g.
Button(..., command = lambda: func_with_args(1, 2, 3))
For example see
http://www.daniweb.com/code/snippet610.html
You could also define explicit, short helper functions if you don't want
to use lambdas.
Kent
More information about the Tutor
mailing list