Is there a way to get all callbacks associated with a widget?
My use case is that I need to change the
options of a
Select widget based on user-interaction. When I make those changes from within the code, I want to disable the callbacks associated with the
Select widget I’m changing. I do this by applying the
remove_on_change() function, after which I make the changes to the widget, and then I apply the
on_change() function to re-add the callback. The callback is a lambda function (since I’m using extra arguments to call the function between the
attr, old, new parameters), so I can’t just remove the original name of the function. So, I want to get all callbacks associated with the widget, and remove them all.
I’m able to do this with:
for callback in myWidget._callbacks['value']: myWidget.remove_on_change('value', callback)
I’d like to keep to the practice of not calling “private” attributes like
_callbacks. However, I don’t see any other way to access them. Is there a method to do this that I’m not seeing?