Skip to content

Commit 177f28c

Browse files
authored
Merge pull request matplotlib#29650 from anntzer/dig
Copy-edit "interactive figures & async programming" guide.
2 parents 7ede092 + e8a3e31 commit 177f28c

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

galleries/users_explain/figure/interactive_guide.rst

+11-11
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Interactive figures and asynchronous programming
1111

1212
Matplotlib supports rich interactive figures by embedding figures into
1313
a GUI window. The basic interactions of panning and zooming in an
14-
Axes to inspect your data is 'baked in' to Matplotlib. This is
14+
Axes to inspect your data is "baked in" to Matplotlib. This is
1515
supported by a full mouse and keyboard event handling system that
1616
you can use to build sophisticated interactive graphs.
1717

@@ -54,7 +54,7 @@ user hits the 'z' key, please run this other function". This allows
5454
users to write reactive, event-driven, programs without having to
5555
delve into the nitty-gritty [#f3]_ details of I/O. The core event loop
5656
is sometimes referred to as "the main loop" and is typically started,
57-
depending on the library, by methods with names like ``_exec``,
57+
depending on the library, by methods with names like ``exec``,
5858
``run``, or ``start``.
5959

6060

@@ -83,7 +83,7 @@ for user input and lets us register functions to be run when that
8383
happens. However, if we want to do both we have a problem: the prompt
8484
and the GUI event loop are both infinite loops that each think *they*
8585
are in charge! In order for both the prompt and the GUI windows to be
86-
responsive we need a method to allow the loops to 'timeshare' :
86+
responsive we need a method to allow the loops to "timeshare" :
8787

8888
1. let the GUI main loop block the python process when you want
8989
interactive windows
@@ -109,7 +109,7 @@ Blocking the prompt
109109

110110

111111
The simplest "integration" is to start the GUI event loop in
112-
'blocking' mode and take over the CLI. While the GUI event loop is
112+
"blocking" mode and take over the CLI. While the GUI event loop is
113113
running you cannot enter new commands into the prompt (your terminal
114114
may echo the characters typed into the terminal, but they will not be
115115
sent to the Python interpreter because it is busy running the GUI
@@ -147,7 +147,7 @@ While running the GUI event loop in a blocking mode or explicitly
147147
handling UI events is useful, we can do better! We really want to be
148148
able to have a usable prompt **and** interactive figure windows.
149149

150-
We can do this using the 'input hook' feature of the interactive
150+
We can do this using the "input hook" feature of the interactive
151151
prompt. This hook is called by the prompt as it waits for the user
152152
to type (even for a fast typist the prompt is mostly waiting for the
153153
human to think and move their fingers). Although the details vary
@@ -386,8 +386,8 @@ sure that you are locking in the critical sections.
386386

387387

388388

389-
Eventloop integration mechanism
390-
===============================
389+
Event loop integration mechanism
390+
================================
391391

392392
CPython / readline
393393
------------------
@@ -404,7 +404,7 @@ run the event loop until a key is pressed on stdin.
404404
Matplotlib does not currently do any management of :c:data:`PyOS_InputHook` due
405405
to the wide range of ways that Matplotlib is used. This management is left to
406406
downstream libraries -- either user code or the shell. Interactive figures,
407-
even with Matplotlib in 'interactive mode', may not work in the vanilla python
407+
even with Matplotlib in "interactive mode", may not work in the vanilla python
408408
repl if an appropriate :c:data:`PyOS_InputHook` is not registered.
409409

410410
Input hooks, and helpers to install them, are usually included with
@@ -433,9 +433,9 @@ method. The source for the ``prompt_toolkit`` input hooks lives at
433433
then the loop would look something like ::
434434
435435
fds = [...]
436-
while True: # Loop
437-
inp = select(fds).read() # Read
438-
eval(inp) # Evaluate / Print
436+
while True: # Loop
437+
inp = select(fds).read() # Read
438+
eval(inp) # Evaluate / Print
439439
440440
.. [#f2] Or you can `write your own
441441
<https://www.youtube.com/watch?v=ZzfHjytDceU>`__ if you must.

0 commit comments

Comments
 (0)