8000 Add ability to disable callbacks temporarily · Issue #20802 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Add ability to disable callbacks temporarily #20802

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

Closed
greglucas opened this issue Aug 6, 2021 · 2 comments · Fixed by #20816
Closed

Add ability to disable callbacks temporarily #20802

greglucas opened this issue Aug 6, 2021 · 2 comments · Fixed by #20816
Milestone

Comments

@greglucas
Copy link
Contributor

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 commented Aug 7, 2021

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

with self.norm.callbacks.disabled():

@QuLogic
Copy link
Member
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
Development

Successfully merging a pull request may close this issue.

3 participants
0