Tkinter and the Menu Widget

Michele Simionato mis6 at
Wed Jun 19 15:27:16 EDT 2002

"Emile van Sebille" <emile at> wrote in message news:<xw%P8.257292$cQ3.11997 at sccrnsc01>...
> You've got a scope issue.  Try:
>         smn[key].add_command(label=submenu,command=lambda key=key,
> submenu=submenu:
>                              dosomething(key+'='+submenu))

Thanks ! This is really magic and it works !!
Actually I had found another method to fix the problem by using
of exec() and eval() but your suggestion is much more elegant.
Thanks again,


More information about the Python-list mailing list