ENH: Add the ability to block callback signals#20816
ENH: Add the ability to block callback signals#20816timhoffm merged 1 commit intomatplotlib:masterfrom
Conversation
story645
left a comment
There was a problem hiding this comment.
I think this could be really useful for debugging interactive stuff, so tentatively 👍
a9680e7 to
ad95b35
Compare
story645
left a comment
There was a problem hiding this comment.
minor nits, but liking the new docs :)
ad95b35 to
dd4385d
Compare
|
What do you think about naming this |
dd4385d to
1cf6384
Compare
|
@timhoffm, apparently there is a preferred convention and your suggestion lines up with that :) |
|
Also, and I might be confused about the functionality here, but would it be possible for the what's new example to be slight less toy/use like one of the auto registrated callbacks or something? |
CallbackRegistry objects now have a context manager .block() method that can be used to temporarily block callback signals from being processed.
1cf6384 to
d9fef33
Compare
|
I came up with another toy-like example, but with interactivity on the figure canvas and disabling key-press events. Did you have another example/area in mind to apply this? It looks like the widgets keep their callbacks private in |
|
Using fig.canvas.callbacks is perfect - I was unsure whether the functionality extended to the fig callbacks and this clears it right up & I think would be a common use case 😄 |
PR Summary
CallbackRegistry objects gain a context manager
.block()method that can be used to temporarily block callback signals from being processed.Closes #20802
Would help with disabling norm update signals in #19553
PR Checklist
pytestpasses).flake8on changed files to check).flake8-docstringsand runflake8 --docstring-convention=all).doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).