Skip to content

Minor fixes to event handling docs. #10656

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

Merged
merged 1 commit into from
Mar 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions doc/users/event_handling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Event handling and picking
**************************

matplotlib works with a number of user interface toolkits (wxpython,
Matplotlib works with a number of user interface toolkits (wxpython,
tkinter, qt4, gtk, and macosx) and in order to support features like
interactive panning and zooming of figures, it is helpful to the
developers to have an API for interacting with the figure via key
Expand Down Expand Up @@ -47,14 +47,16 @@ disconnect the callback, just call::
fig.canvas.mpl_disconnect(cid)

.. note::
The canvas retains only weak references to the callbacks. Therefore
if a callback is a method of a class instance, you need to retain
a reference to that instance. Otherwise the instance will be
garbage-collected and the callback will vanish.
The canvas retains only weak references to instance methods used as
callbacks. Therefore, you need to retain a reference to instances owning
such methods. Otherwise the instance will be garbage-collected and the
callback will vanish.

This does not affect free functions used as callbacks.


Here are the events that you can connect to, the class instances that
are sent back to you when the event occurs, and the event descriptions
are sent back to you when the event occurs, and the event descriptions:


======================= =============================================================================================
Expand Down
17 changes: 8 additions & 9 deletions examples/event_handling/README.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
.. _event_handling_examples:

Event Handling
Event handling
==============

Matplotlib supports event handling with a GUI neutral event model, so
you can connect to Matplotlib events without knowledge of what user
interface Matplotlib will ultimately be plugged in to. This has two
advantages: the code you write will be more portable, and Matplotlib
events are aware of things like data coordinate space and which axes
the event occurs in so you don't have to mess with low level
transformation details to go from canvas space to data space. Object
picking examples are also included.
Matplotlib supports :doc:`event handling</users/event_handling>` with a GUI
neutral event model, so you can connect to Matplotlib events without knowledge
of what user interface Matplotlib will ultimately be plugged in to. This has
two advantages: the code you write will be more portable, and Matplotlib events
are aware of things like data coordinate space and which axes the event occurs
in so you don't have to mess with low level transformation details to go from
canvas space to data space. Object picking examples are also included.