Tkinter and the Menu Widget

Michele Simionato mis6 at pitt.edu
Wed Jun 19 21:27:16 CEST 2002


"Emile van Sebille" <emile at fenx.com> 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,

                           Michele



More information about the Python-list mailing list