tkinter btn visual state with tkMessageBox
Hendrik van Rooyen
mail at microcorp.co.za
Sat Aug 19 11:49:06 EDT 2006
<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
More information about the Python-list
mailing list