menu.add_command options

Eric Brunel eric.brunel at pragmadev.com
Wed Mar 27 12:47:26 EST 2002


Paul Sage wrote:
> Tkinter:
> In the line:
> 
> file_menu.add_command(label='Load Form', underline=0,
> command=self.open_file)
> 
> Does anyone have a list of options that go with the menu.add_command?  I
> need to pass the frame to the method open_file, but I don't know how to
> pass that as an argument.

You can't do that via any option in the add_menu method. Use 
"command=lambda o=self, f=yourFrame: o.open_file(f))" or the trick I gave 
in 
http://groups.google.com/groups?hl=en&selm=a4alhq%246tp%241%40norfair.nerim.net

BTW, the answer to your original question (options for the add_menu method) 
may be found there:
http://www.pythonware.com/library/tkinter/introduction/index.htm
(in the part "Tkinter Reference" under "Menu", but just the option names I 
fear...) or there:
http://dev.scriptics.com/man/tcl8.3/TkCmd/contents.htm
if you know how to convert tcl-like syntax to Python-like syntax (usually 
read "option=value" where the manual says "-option value").

HTH
 - eric -




More information about the Python-list mailing list