[Tkinter-discuss] optionmenu insert

Michael Lange klappnase at web.de
Thu May 4 11:17:34 CEST 2006


On Wed, 03 May 2006 13:37:31 +0200
Pavel Kosina <geon at post.cz> wrote:


> >
> >     w['menu'].insert('end', 'command', label='blah', command=lambda : ok_new('blah'))
> >   
> this works with me even without new ok_new - with the old one:
> 
>     w['menu'].insert('end', 'command', label='blah', command=lambda : ok('blah'))
> 

It does not change the value of the variable, so the ok() callback will have to do this, like

    def ok(value):
        var.set(value)
        (...)

Now, I forgot about this solution, maybe the easiest of all.

Michael



More information about the Tkinter-discuss mailing list