tkinter btn visual state with tkMessageBox

jmdeschamps at gmail.com jmdeschamps at gmail.com
Sat Aug 19 19:24:01 EDT 2006


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 *
> | import tkMessageBox
> |
> | class Vue(object):
> |     def __init__(self):
> |         self.root=Tk()
> |         self.root.title("test button visual state")
> |         self.b1=Button(self.root,text="tkMessageBox.showinfo with bind
> | :-(") #,command=self.showMsg)
> |         self.b1.bind("<Button>",self.showMsg)
>
> 8<---------------------------------------------------------------------------
>
> change this to :
>
>            self.b1.bind("<ButtonRelease>",self.showMsg)
>
> Problem is that a button "sinks in" when you press it and "springs back" when
> you release it...
>
> 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




More information about the Python-list mailing list