Matplotlib WIndow Not responding when loop is initialized I am initializing empty figure when executing plt.figure(). It openes fine. But as soon as I have the following code implemented opened graph gets not responding. Any idea why this window is getting not responding?

import matplotlib.pyplot as plt
plt.figure()   # It opens graph fine

with open("data.txt") as file_data:

    while True:
        pass
The while True: loop will be causing the python interpreter to think there's something more to do. It will remain unresponsive until it 'finishes' that loop, which it will never do. Remove the Loop or replace pass with break