How do you disable an event handler in code?

You could give it an empty handler:

self.text_area_1.set_event_handler('change', lambda **e: None)

(That defines a function that accepts any keyword arguments, and always returns None)

However, it’s usually more understandable if you set some some sort of variable as a flag, and check it at the top of your event handler.

1 Like