Tkinter menu question--how to pass arguments



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
.



Relevant Pages

  • Re: Multi-Query enter date based on checkbox
    ... I would like to set a query or some such thing that will set the underlying ... Well, a command button... ... structuring it as a one to many relationship with a second table; ... it is (based on the labels of your fifty checkboxes), ...
    (microsoft.public.access.formscoding)
  • Re: Tk application hangs
    ... KW> explicitly reached eof and it hangs? ... KW> | Kevin Walzer wrote: ... KW> |>after running just one command. ... KW> |>"List Packages" is supposed to list all available DarwinPorts packages ...
    (comp.lang.tcl)
  • Re: ie6sp1 : Repair Function Blocked - Anyone know of a fix?
    ... Robert Aldwinckle wrote: ... >> Unfortunately am having a bit of difficulty with GetVers. ... > for command itself not to the thing it is being used to execute. ... Ran Registry Find - one entry: ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: ie6sp1 : Repair Function Blocked - Anyone know of a fix?
    ... I already explained that that command cannot ... work because there is no DllRegisterServer entry point in that module. ... there is a DllInstall entry point there. ... NTx uses the registry value. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Messages at form closing?
    ... the user's entry. ... > Save command buttong, so I coded my own that updates to the degree I ... One one of the subforms is a command ... >>> Change the data in the field or fields that contain the duplicate data, ...
    (microsoft.public.access.modulesdaovba)