Python Forum
Matplotlib - close multple plots with user input - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Matplotlib - close multple plots with user input (/thread-35689.html)



Matplotlib - close multple plots with user input - Positron79 - Dec-01-2021

Hi,

I have a script that is reading CSV files. Plots 9 graphs at once. I would like for the user to press enter so that all plots close at once. IT used to work with prevvious version of matplotlib, but I've now upgraded to 3.5 and it doesnt like the code anymore. At the moment, the script is written like this and it only asks for press enter after the plots are closed individually, then it exits the script. See below for both versions of scripts

Old code (pre-matplotlib version 3.5), user would just press enter to close all plots and exit script
 # Pause to close plots
    plt.show(False)    # Blocks, user must close plot window
    print("")
    input("Press [enter] key to close plots...")
    print("Done...")
new code (matplotlib version 3.5), user has to close all plots individualy and press enter to exit script

  # Pause to close plots
    print("Close all Plots to Exit")
    plt.show(block=True)  # Blocks, user must close plot window
    print("")
    input("Press [enter] to exit...")
    print("Done...")
any guidance would be greatly appreciated