J
jmdeschamps
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)
self.b2=Button(self.root,text="tkMessageBox.showinfo with
command ",command=self.showMsg)
self.b1.pack()
self.b2.pack()
self.root.mainloop()
def showMsg(self,evt=1):
if evt==1:
txt="From button with command"
else:
txt="From button with bind"
tkMessageBox.showinfo("Test of button", txt)
if __name__=="__main__":
v=Vue()
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)
self.b2=Button(self.root,text="tkMessageBox.showinfo with
command ",command=self.showMsg)
self.b1.pack()
self.b2.pack()
self.root.mainloop()
def showMsg(self,evt=1):
if evt==1:
txt="From button with command"
else:
txt="From button with bind"
tkMessageBox.showinfo("Test of button", txt)
if __name__=="__main__":
v=Vue()