Dynamic command on Menu items?

Joe S joeschey at earthlink.net
Thu Aug 26 14:37:31 EDT 2004


"Diez B. Roggisch" <deetsNOSPAM at web.de> wrote in message news:<cgj05d$7ud$01$2 at news.t-online.com>...
> You could do it like this (untested):
> 
> class FunClosure:
>     def __init__(self, f, args):
>         self.f = f
>         self.args = args
>     def __call__(self):
>         self.f(self.args)
> 
> M.menu.add_command(label=l, command=FunClosure(f, [p]))


Sorry...no work. It says str object is not callable.

I would def. appreciate any refinement. If not, thanks anyway for trying.


Joe



More information about the Python-list mailing list