A disconnected callback cannot be reconnected #1630

Merged
merged 1 commit into from Jan 4, 2013

Projects

None yet

2 participants

@anntzer
Collaborator
anntzer commented Jan 1, 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 mdboom merged commit 78fa072 into matplotlib:v1.2.x Jan 4, 2013

1 check failed

Details default The Travis build failed
@mdboom mdboom deleted the mdboom:reconnect_callbacks branch Aug 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment