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

Skip to content

Commit ff01737

Browse files
authored
Merge pull request #32321 from tacaswell/doc/fix_inputhook_docs
DOC: correct note about PyOS_InputHook
2 parents 284213d + 046fe61 commit ff01737

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

galleries/users_explain/figure/interactive_guide.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -405,17 +405,18 @@ The hook functions typically exhaust all pending events on the GUI
405405
event queue, run the main loop for a short fixed amount of time, or
406406
run the event loop until a key is pressed on stdin.
407407

408-
Matplotlib does not currently do any management of :c:data:`PyOS_InputHook` due
409-
to the wide range of ways that Matplotlib is used. This management is left to
410-
downstream libraries -- either user code or the shell. Interactive figures,
411-
even with Matplotlib in "interactive mode", may not work in the vanilla python
412-
repl if an appropriate :c:data:`PyOS_InputHook` is not registered.
413-
414-
Input hooks, and helpers to install them, are usually included with
415-
the python bindings for GUI toolkits and may be registered on import.
408+
Interactive figures, even with Matplotlib in "interactive mode", may not work
409+
in REPL if an appropriate :c:data:`PyOS_InputHook` is not registered. This
410+
management is left to upstream libraries or downstream code -- either explicit
411+
user code or shell initialization -- in all toolkits but native macOS. Input
412+
hooks, and helpers to install them, are usually included with the Python
413+
bindings for GUI toolkits and may be registered on import. For the macOS
414+
native toolkit Matplotlib owns code that exposes the toolkit to Python and thus
415+
we register :c:data:`PyOS_InputHook` on GUI application initialization.
416+
416417
IPython also ships input hook functions for all of the GUI frameworks
417-
Matplotlib supports which can be installed via ``%matplotlib``. This
418-
is the recommended method of integrating Matplotlib and a prompt.
418+
Matplotlib supports which can be installed via ``%matplotlib``. This is the
419+
recommended method of integrating Matplotlib and a prompt.
419420

420421

421422
IPython / prompt_toolkit

0 commit comments

Comments
 (0)