A disconnected callback cannot be reconnected #1630

Merged
merged 1 commit into from Jan 4, 2013

Conversation

Projects
None yet
1 participant
Contributor

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 mdboom added a commit that referenced this pull request Jan 4, 2013

@mdboom mdboom Merge pull request #1630 from mdboom/reconnect_callbacks
A disconnected callback cannot be reconnected
78fa072

@mdboom mdboom merged commit 78fa072 into matplotlib:v1.2.x Jan 4, 2013

1 check failed

default The Travis build failed
Details

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