Python Forum

Full Version: Matplotlib - close multple plots with user input
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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