tkinter btn visual state with tkMessageBox

jmdeschamps at gmail.com jmdeschamps at gmail.com
Sun Aug 20 08:53:04 EDT 2006


Hendrik van Rooyen wrote:
> <jmdeschamps at gmail.com> Wrote:
> |
> | Hendrik van Rooyen wrote:
> | > <jmdeschamps at gmail.com> wrote:
> | >
> | > To: <python-list at python.org>
> | >
> | >
> | > | why is the button sunken when called through a bind method, and not
> | > | with the command attribute?
> | > | Thank you!
> | > |
> | > |
> | > | ## Cut'nPaste example
> | > | from Tkinter import *
 ...
> | > and the "Button" leaves it sunken.... - because when you release, the
> control is
> | > no longer there
> | >
> | > - Hendrik
> | Thanks Hendrik - is the command attribute connected to the bindable
> | events?
> | jm
>
> I don't have a clue - you are either asking about advanced magic here,
> or I don't understand your question - I believe the lower level routines
> are common, but I don't *Know* this - so its a pity that some people
> who shall be nameless have beaten their brains out in a thread about
> a directory name here..
>
> You may have noticed that there is another subtle bug with what I have
> suggested to you - when you press the offending button, then move the
> mouse to move the cursor off the screen button, - the button
> "springs back" as expected - but then when you release the mouse
> button, off the screen button, the call back is done anyway, instead of
> being cancelled when the cursor moves off the screen button.
>
> - for the command case, the sequence is different, and the call back is done
> only if the release is done on the screen button...
>
>   - But this may just be my setup - does yours do the same?
>
> I don't know how to fix that - you could look at sequences of events - button
> push followed by release - But I doubt whether this will help, as its doing
> something like that anyway (haven't tried it)
>
> - Hendrik

Same behavior here - Also, I added a bind to Button event and another
to ButtonRelease, and also had the command attribute. All three
*events* are processed, in similar fashion that you describe above.
Finally, the command attribute seems to works like a ButtonRelease  BUT
still permits a binding to another function on a ButtonRelease event
(and only one) so if the lower level functions might be the same the
path to them seem different.
I found this article that pertains to the question:
http://www.ferg.org/thinking_in_tkinter/tt075.py
but I'll postpone my own investigation at this time to return to my
program ;-)
Thanks again,

Jean-Marc




More information about the Python-list mailing list