I use python matplotlibto draw shapes.
I want to draw a figure with a timeout of, say, 3 seconds, and the window closes to move around the code.
I knew that I pyplot.show()would create a lock window with an unlimited timeout; pyplot.show(block=False)or pyplot.draw()make the window non-blocking. But I want a block of code a few seconds.
I got the idea that I can use an event handler or something like that, but still don't quite understand how to solve this. Is there a simple and elegant solution?
Suppose my code is as follows:
Draw.py:
import matplotlib.pyplot as plt
plt.show()
source
share