May-05-2021, 04:22 PM
If you want to go with using the disabled state you could check the state in the event handler and just return if it's disabled.
import tkinter as tk class App(tk.Tk): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.label = tk.Label(self, text='Click me') self.label.bind('<Button-1>', self.on_label_click) self.label.pack() self.button = tk.Button(self, text='toggle label state') self.button.bind('<Button-1>', self.on_button_click) self.button.pack() def on_label_click(self, event): if 'disabled' in event.widget.config('state'): print('Label is disabled: Do nothing') return print('Label is enabled: Do something') def on_button_click(self, event): if 'disabled' in self.label.config('state'): self.label.config(state='normal') else: self.label.config(state='disabled') if __name__ == "__main__": app = App() app.mainloop()