Dynamic command on Menu items?

Diez B. Roggisch deetsNOSPAM at web.de
Wed Aug 25 23:26:19 CEST 2004


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]))

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list