Visitar URL original
Add ability to disable callbacks temporarily · Issue #20802 · matplotlib/matplotlib · GitHub
The Wayback Machine - https://web.archive.org/web/20210904213203/https://github.com/matplotlib/matplotlib/issues/20802
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to disable callbacks temporarily #20802

Closed
greglucas opened this issue Aug 6, 2021 · 2 comments
Closed

Add ability to disable callbacks temporarily #20802

greglucas opened this issue Aug 6, 2021 · 2 comments
Milestone

Comments

@greglucas
Copy link
Contributor

@greglucas greglucas commented Aug 6, 2021

It may be useful to update some attributes on an object that has callbacks temporarily and we don't want those callback signals being processed during that time.

I guess we could add a disabling_callbacks() context manager on CallbackRegistry?

with self.norm.callbacks.disabling_callbacks(), cbook._setattr_cm(self.norm, ...): ...

Originally posted by @anntzer in #19553 (comment)

@timhoffm
Copy link
Member

@timhoffm timhoffm commented Aug 7, 2021

Naming suggestion: callbacks_disabled() or even only disabled():

with self.norm.callbacks.disabled():

@QuLogic
Copy link
Member

@QuLogic QuLogic commented Aug 9, 2021

In Qt, this is Widget->blockSignals, and in GTK, it is g_signal_handlers_block_*. Wx has a wxEventBlocker that you add on a widget to temporarily stop events. Not sure if Tk has anything similar.

IOW, it seems like 'block' is the common term for this for events, though I don't know if these callbacks qualify as 'events'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants