Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a7704ad

Browse files
committed
docs: in event_handling, note that weak references to callbacks are used.
svn path=/branches/v1_0_maint/; revision=8723
1 parent 81674c3 commit a7704ad

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

doc/users/event_handling.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ disconnect the callback, just call::
4646

4747
fig.canvas.mpl_disconnect(cid)
4848

49+
.. note::
50+
The canvas retains only weak references to the callbacks. Therefore
51+
if a callback is a method of a class instance, you need to retain
52+
a reference to that instance. Otherwise the instance will be
53+
garbage-collected and the callback will vanish.
54+
55+
4956
Here are the events that you can connect to, the class instances that
5057
are sent back to you when the event occurs, and the event descriptions
5158

0 commit comments

Comments
 (0)