Skip to content Skip to sidebar Skip to footer

Even If The Button ['state']=disabled, It Activates The And Command Functions

I made myself a program in which I have multiple buttons and I need that buttons to send me a command when they are released. self.predefined_1_button=Button(self.Background_Main,

Solution 1:

The state is managed properly when calling the function assigned to the command attribute. If you bypass the command attribute and add your own bindings, it is up to you to check the state of the widget.

You will need to modify self.function1 and self.function2 to check the state, and only do their function if the state is normal.

def self.function1(self, event):
    ifevent.widget.cget("state") == "disabled":
        return
    ...

Post a Comment for "Even If The Button ['state']=disabled, It Activates The And Command Functions"