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

A disconnected callback cannot be reconnected #1630

Merged
merged 1 commit into from Jan 4, 2013

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Jan 2, 2013

Consider the following example:

import matplotlib.pyplot as plt
fig, ax = plt.subplots()
p = lambda event: print(event)
cid = fig.canvas.mpl_connect("button_press_event", p)
print("connection", cid)
if __debug__:
    print("disconnect, reconnect")
    fig.canvas.mpl_disconnect(cid)
    cid = fig.canvas.mpl_connect("button_press_event", p)
    print("connection", cid)
plt.show()

One would expect the callback to be connected whether __debug__ is True or False, but in fact after the disconnection and reconnection, nothing happens anymore on button press.

mdboom added a commit that referenced this pull request Jan 4, 2013
A disconnected callback cannot be reconnected
@mdboom mdboom merged commit 78fa072 into matplotlib:v1.2.x Jan 4, 2013
@mdboom mdboom deleted the reconnect_callbacks branch August 7, 2014 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant