using show() and close() from matplotlib

Viewed 20781

I am experiencing some problems with matplotlib.... I can't open 2 windows at once to display a image with show(), it seems that the script stops at the line i use show and doesn't continue unless I close the display manually. Is there a way to close the figure window within the scrip?

the following code doesn't run as I want:

import matplotlib.pyplot as plt
from time import sleep
from scipy import eye

plt.imshow(eye(3))
plt.show()
sleep(1)
plt.close()
plt.imshow(eye(2))
plt.show()

I expected the first window to close after 1 second and then opening the second one, but the window doesn't close until I close it myself. Am I doing something wrong, or is it the way it is supposed to be?

2 Answers
Related