Tkinter: OptionMenu question

Peter Funk pf at artcom-gmbh.de
Thu Mar 9 12:57:44 CET 2000


Hi!

>  |Randall Hopper:
>  |> How do you set the font?
>  |> 
>  |> This:
>  |> 
>  |>     menu = apply( OptionMenu, ( parent, var ) + tuple( option_names ),
>  |>                   { 'font':PANEL_FONT } )
>  |> 
>  |> generates:
>  |> 
>  |>     TypeError: unexpected keyword argument: font
>  |
> Peter Funk:
>  |Since 'Tkinter' itself contains no class 'OptionMenu', I guess you
>  |are using the fine Pmw package by Greg McFarlane.
> 
> 
> Hi.  Thanks for the reply.  Actually I was using Tkinter.  Tkinter does
> have an OptionMenu class written in Python code that is instantiable (see
> Tkinter.py::OptionMenu).

Yes.  Indeed.  I should have better checked before posting.  :-(

However this "poor mans" OptionMenu class only provides a very raw
wrapper around the MenuButton class.  As far as I can see from the
source in Tkinter.py the only way to set the font is to access
the menu component afterwards and use 
	menu['menu'].configure(font=....) 
to change the font.

You should consider getting your hands on the Pmw.

Regards from Germany, Peter
-- 
Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260
office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen)




More information about the Python-list mailing list