Tkinter button problem
effbot at telia.com
Wed Mar 8 19:39:45 CET 2000
Thomas Lane <tom at parlant.com> wrote:
> In a Tkinter program that I am writing, I have noticed that buttons that
> caise a dialog to open stay "pressed" (ie. they are still sunken) when
> the dialog returns. Buttons that do a command of some sort (ie. don't
> open a dialog) seem to behave normally. Is this normal?
not really. you seem to be doing something weird here...
> Is there a way to force a button to its non-sunken state before returning
> from my button-click event handler?
event handler? you shouldn't be using event handlers to
catch button clicks. using the "command" option instead
should fix this.
or in other words, it sounds as if you're doing:
b = Button(root, text="foo") # Button = button widget
b.bind("<Button-1>", callback) # Button = mouse button
b = Button(root, text="foo", command=callback)
(note that the command callback takes no arguments,
while an event handler takes an event descriptor as its
More information about the Python-list