@@ -10,8 +10,10 @@ a figure to inspect your data, however there is also a full mouse and
1010keyboard event handling system to enable building sophisticated interactive
1111graphs.
1212
13- This page is meant to be a rapid introduction to the relevant details of
14- integrating the matplotlib with a GUI event loop.
13+ This page is meant to be a rapid introduction to the relevant details
14+ of integrating the matplotlib with a GUI event loop. For further
15+ details see `Interactive Applications using Matplotlib
16+ <http://www.amazon.com/Interactive-Applications-using-Matplotlib-Benjamin/dp/1783988843> `__.
1517
1618
1719The GUI event loop
@@ -35,34 +37,34 @@ The python capi provides a hook, `PyOS_InputHook`, to register a
3537function to be run "The function will be called when Python's
3638interpreter prompt is about to become idle and wait for user input
3739from the terminal.". This hook can be used to integrate a second
38- event loop with the python repl. Such a hooks are usually included
39- with the python bindings for GUI toolkits and may be registered on
40- import. IPython also includes hooks for all of the GUI frameworks
41- supported by matplotlib. The hook functions typically exhaust
42- all pending events on the GUI event queue, run the main loop for a
43- short fixed amount of time, or run the event loop until a key is
44- pressed on stdin.
40+ event loop ( the GUI event loop) with the python input prompt loop.
41+ Such hooks are usually included with the python bindings for GUI
42+ toolkits and may be registered on import. IPython also includes hooks
43+ for all of the GUI frameworks supported by matplotlib. The hook
44+ functions typically exhaust all pending events on the GUI event queue,
45+ run the main loop for a short fixed amount of time, or run the event
46+ loop until a key is pressed on stdin.
4547
4648matplotlib does not currently do any management of `PyOS_InputHook `
4749due to the wide range of ways that matplotlib is used. This
4850management is left to the code using matplotlib. Interactive figures,
4951even with matplotlib in 'interactive mode', may not work in the
5052vanilla python repl if an appropriate `PyOS_InputHook ` is not
5153registered. We suggest using ``IPython ``, which in addition to
52- improving the command line, ensures that such a `PyOS_InptuHook `
54+ improving the command line, ensures that such a `PyOS_InputHook `
5355function is registered for you GUI backend of choice.
5456
5557A drawback of relying on `PyOS_InputHook ` is that the GUI event loop
5658is only processing events while python is otherwise idle and waiting
5759for user input. If you want the GUI to be responsive during long
5860running code it is necessary to periodically flush the GUI event
59- queue. To achive this, almost all of the of the GUI-based ``Canvas ``
61+ queue. To achieve this, almost all of the of the GUI-based ``Canvas ``
6062classes provide a `flush_event ` method. By periodically calling this
6163method the GUI will be updated and appear to be responsive.
6264
6365In both cases, to schedule a re-draw of the figure at some point in
6466the future use ``fig.canvas.draw_idle() ``. This will defer the actual
65- rendering of the figure until the GUI is ready to update it's
67+ rendering of the figure until the GUI is ready to update its
6668on-screen representation.
6769
6870Stale Artists
0 commit comments