@@ -11,7 +11,7 @@ Interactive figures and asynchronous programming
11
11
12
12
Matplotlib supports rich interactive figures by embedding figures into
13
13
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
15
15
supported by a full mouse and keyboard event handling system that
16
16
you can use to build sophisticated interactive graphs.
17
17
@@ -54,7 +54,7 @@ user hits the 'z' key, please run this other function". This allows
54
54
users to write reactive, event-driven, programs without having to
55
55
delve into the nitty-gritty [#f3 ]_ details of I/O. The core event loop
56
56
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 ``,
58
58
``run ``, or ``start ``.
59
59
60
60
@@ -83,7 +83,7 @@ for user input and lets us register functions to be run when that
83
83
happens. However, if we want to do both we have a problem: the prompt
84
84
and the GUI event loop are both infinite loops that each think *they *
85
85
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" :
87
87
88
88
1. let the GUI main loop block the python process when you want
89
89
interactive windows
@@ -109,7 +109,7 @@ Blocking the prompt
109
109
110
110
111
111
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
113
113
running you cannot enter new commands into the prompt (your terminal
114
114
may echo the characters typed into the terminal, but they will not be
115
115
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
147
147
handling UI events is useful, we can do better! We really want to be
148
148
able to have a usable prompt **and ** interactive figure windows.
149
149
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
151
151
prompt. This hook is called by the prompt as it waits for the user
152
152
to type (even for a fast typist the prompt is mostly waiting for the
153
153
human to think and move their fingers). Although the details vary
@@ -386,8 +386,8 @@ sure that you are locking in the critical sections.
386
386
387
387
388
388
389
- Eventloop integration mechanism
390
- ===============================
389
+ Event loop integration mechanism
390
+ ================================
391
391
392
392
CPython / readline
393
393
------------------
@@ -404,7 +404,7 @@ run the event loop until a key is pressed on stdin.
404
404
Matplotlib does not currently do any management of :c:data: `PyOS_InputHook ` due
405
405
to the wide range of ways that Matplotlib is used. This management is left to
406
406
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
408
408
repl if an appropriate :c:data: `PyOS_InputHook ` is not registered.
409
409
410
410
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
433
433
then the loop would look something like ::
434
434
435
435
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
439
439
440
440
.. [#f2 ] Or you can `write your own
441
441
<https://www.youtube.com/watch?v=ZzfHjytDceU> `__ if you must.
0 commit comments