<[EMAIL PROTECTED]> Wrote: | | Hendrik van Rooyen wrote: | > <[EMAIL PROTECTED]> wrote: | > | > To: <python-list@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
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 -- http://mail.python.org/mailman/listinfo/python-list