the_martian the_martian - 1 year ago 62
Python Question

matplot program gives unresponsive window when run

You'll notice that there is a bunch of missing code, it's for all the games being called from the menu. I removed it because it is long and not needed for my question. My issue is only with a particular function,

. When I call it from the menu, matplot opens in a new window and just crashes immediately. I just set up the basic plot below for testing. Any ideas?

import matplotlib.pyplot as plt

def display_data():

# (6) Save Progress ------------------------------------------------------------

# (7) Load Data ----------------------------------------------------------------

# (8) Quit Game ----------------------------------------------------------------

def quit_game():
print('\nThank you for playing!')

# Main Menu --------------------------------------------------------------------

def menu():
calculation_game = print("\nEnter 1 to play 'Calculation'")
bin_reader = print("Enter 2 to play 'Binary Reader'")
trifacto = print("Enter 3 to play 'Trifacto'")
statistics = print("Enter 4 to view your statistics")
display_data = print("Enter 5 to display data")
save_game = print("Enter 6 to save your progress")
load_data = print("Enter 7 to load data")
quit_game = print("Enter 8 to quit the game")

def main_menu():
print('Welcome to BrainAge!')
main_record = []
user_input = ''
while user_input != '8':
user_input = input('\nWhat would you like to do? ')
if user_input == '1':
if user_input == '2':
if user_input == '3':
if user_input == '4':
if user_input == '5':
if user_input == '8':


Answer Source

I had a similar problem a while back, try setting this line


According to the docs this overrides the blocking behaviour caused by running matplotlib.pyplot in interactive mode, which is known to cause issues in some environments. I believe this only works for the latest version of matplotlib.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download