Tkinter Callback question
Jack B.
barfsky at hotmail.com
Mon Aug 12 16:04:13 EDT 2002
Perhaps someone can help me with the proper syntax using the
"command=" option while making a menu button. Here's what I want to
do:
for number in range(-4,1):
temp = get_dates.dbdate(number)
date_menu.add_command(label=temp, command=self.set_valid_date(temp)
menubar.add_cascade(label="Choose Date", menu=date_menu)
(get_dates.dbdate will return a correctly formatted date, given number
of days back or forward. set_valid_date will set act on the date
passed)
This code will list dates from today back 4 days but I can't seem to
call the "command" part and pass any data. The command executes
immediatly, and the buttons created do nothing. Surely there is a way
to do this? The only way I can execute a command is by NOT passing
any data, ie.. command=self.hello.
rb
More information about the Python-list
mailing list