Tkinter menu question--how to pass arguments
- From: Kevin Walzer <kw@xxxxxxxxxxxxxxx>
- Date: Fri, 30 Mar 2007 15:32:21 -0400
I'm having difficulty structuring a Tkinter menu entry. Here is the command in question:
self.finkmenu.add_command(label='Update List of Packages', command=self.authorizeCommand(self.scanPackages))
When I start my program, it crashes because it's trying to run the command self.authorizeCommand. The reason I'm structuring it in this fashion is that this command takes another command as an argument--in this case, self.ScanPackages.
The basic structure of the program is that the self.authorizeCommand function pops up a dialog box for a password; it then feeds the password to the function that it takes as an argument, i.e. self.scanPackages.
I tried setting up the menu entry without the additional parameter, i.e. command=self.authorizeCommand, but then when I try to run the command from the menu, it complains there are not enough arguments. Unsurprising, since self.authorizeCommand takes another function name as an argument.
How can I structure the menu item to reflect the correct number of arguments without it trying to execute the command?
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
.
- Follow-Ups:
- Re: Tkinter menu question--how to pass arguments
- From: kyosohma
- Re: Tkinter menu question--how to pass arguments
- From: kyosohma
- Re: Tkinter menu question--how to pass arguments
- From: Dave Opstad
- Re: Tkinter menu question--how to pass arguments
- Prev by Date: Re: New to Python - Easy way to open a text file
- Next by Date: Re: New to Python - Easy way to open a text file
- Previous by thread: Re: LRU cache (and other things missing from the standard library ...)
- Next by thread: Re: Tkinter menu question--how to pass arguments
- Index(es):
Relevant Pages
|