Optionmenu.

klappnase klappnase at web.de
Thu Sep 4 16:53:45 EDT 2003


Thor <thor__00 at yahoo.com> wrote in message news:<bj7j47$g5rpn$1 at ID-108351.news.uni-berlin.de>...
> I have the following function (with some things removed):
> 
> def add_stock():    
>     stockw=Tk()
>     stockw.title("New stock solution")
>     sofl=Frame(stockw)
>     sofl.pack()
>     u=StringVar()
>     u.set("M")
>     cw=OptionMenu(sofl,u,"M","m","u","v","w")
>     cw.grid(row=1,column=2)
> 
> but the widget keeps not showing teh selected option. If I fo the same out
> of the function it works without problem (with stockw.mainloop()). What am
> I missing? Anybody can point me out to the solution/the right webpage?

Hi,

I'm not sure if that is your problem here, but I think you should not use pack()
and grid() inside the same window, otherwise strange things might happen.
Maybe with sofl.grid() it will work.

Michael




More information about the Python-list mailing list