Python Forum
pygtk2, how to disconnect all callback of widget or window event ? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: pygtk2, how to disconnect all callback of widget or window event ? (/thread-2109.html)



pygtk2, how to disconnect all callback of widget or window event ? - harun2525 - Feb-19-2017

hello, i want disconnect all event callbacks, for exemple button.alldisconnect("clicked") method.
this method disconnects all callback of clicked event. is there any class method or function for do this?
thanks for your helps


RE: pygtk2, how to disconnect all callback of widget or window event ? - Larz60+ - Feb-19-2017

I doubt it. Each widget is a separate instance of it's class, which means each has it's own bindings
for events. It would be very unlikely that all instances would have a universal unset.
That being said, it would be possible (though difficult, and I think you'd have to write your own) to do so by walking the children of the main widget,
for example root in tkinter.

Removing all binding on a particular widget should be easy, just search for and remove all bind and command statements.

But first, please provide enough information to properly answer the question.
Since there at least 4 relatively common graphics packages in use, it is necessary to know what you are using.