FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

DOC: tweak wording on Figure.show warning by tacaswell · Pull Request #24607 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
19 changes: 13 additions & 6 deletions lib/matplotlib/figure.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2614,18 +2614,25 @@ def show(self, warn=True):
may only be shown briefly or not shown at all if you or your
environment are not managing an event loop.

Proper use cases for `.Figure.show` include running this from a
GUI application or an IPython shell.

If you're running a pure python shell or executing a non-GUI
python script, you should use `matplotlib.pyplot.show` instead,
which takes care of managing the event loop for you.
Use cases for `.Figure.show` include running this from a GUI
application (where there is persistently an event loop running) or
from a shell, like IPython, that install an input hook to allow the
interactive shell to accept input while the figure is also being
shown and interactive. Some, but not all, GUI toolkits will
register an input hook on import. See :ref:`cp_integration` for
more details.

If you're in a shell without input hook integration or executing a
python script, you should use `matplotlib.pyplot.show` with
``block=True`` instead, which takes care of starting and running

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

block=True is the default?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The default depends on if we are in "interactive mode" or not.

the event loop for you.

Parameters
----------
warn : bool, default: True
If ``True`` and we are not running headless (i.e. on Linux with an
unset DISPLAY), issue warning when called on a non-GUI backend.

"""
if self.canvas.manager is None:
raise AttributeError(
Expand Down

Back | FazBrowse Home | New Git URL