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.
I have just checked, and figure.show() works ALSO in a pure python shell (here it's 3.9, in Suse Tumbleweed).
Suggested improvement
Specify that after version 3.x (??) of the interpreter the event loop is managed also by a vanilla Python REPL.
This needs a closer investigation, including python versions and backends. We can only broaden the usage of figure.show() if we are absolutely sure that it works in all scenarios.
I suspect the re-wording should be something like "this will put the window on the screen, but you are on your own to ensure an event loop is running for the Figure to be responsive (or ever render). Use at your own risk https://matplotlib.org/stable/users/explain/interactive_guide.html" ?
@MdUmar-tech I'm not sure why asking a random user for their email would be helpful. If you have Matplotlib usage questions, please post them on https://discourse.matplotlib.org.
Activity
timhoffm commented on Jan 11, 2022
This needs a closer investigation, including python versions and backends. We can only broaden the usage of figure.show() if we are absolutely sure that it works in all scenarios.
tacaswell commented on Jan 11, 2022
It is not the version of Python, but the GUI bindings. The ones I know off the top of my head are Qt: PyQt5 / PyQt6 register PyOs_InputHook ( https://docs.python.org/3/c-api/veryhigh.html#c.PyOS_InputHook) but pyside2/pyside6 does not. However, In the PyQt case there as also API to remove the input hook. I think tk also sets up the inputhook on import, not sure about gtk/wx/macsox off the top of my head. See https://matplotlib.org/stable/users/explain/interactive_guide.html#input-hook-integration for more details.
I suspect the re-wording should be something like "this will put the window on the screen, but you are on your own to ensure an event loop is running for the Figure to be responsive (or ever render). Use at your own risk
https://matplotlib.org/stable/users/explain/interactive_guide.html" ?
DOC: tweak wording on Figure.show warning
DOC: tweak wording on Figure.show warning
DOC: tweak wording on Figure.show warning
MdUmar-tech commented on Dec 11, 2023
@boffi , Hi I have some doubt, can I get your mail id
QuLogic commented on Dec 12, 2023
@MdUmar-tech I'm not sure why asking a random user for their email would be helpful. If you have Matplotlib usage questions, please post them on https://discourse.matplotlib.org.