To summarize: I want to open a frame in Python, be able to work with this frame, and also be able to continue to use this terminal.
Basically, I would like to emulate some Matlab behavior in Python. In Matlab you can:
x=0:10; y=0:10; plot(x,y)
and the graph will appear, it will be interactive, and you will also get access to the terminal to make a difference and do other work.
I realized that in Python, if I sliced ββcorrectly, I could do the same. However, the code below controls the terminal.
from threading import Thread from matplotlib import pyplot as plt class ThreadFrame(Thread): def __init__(self): Thread.__init__(self) def setup(self): my_plot = plt.plot(range(0,10), range(0,10)) fig = plt.gcf() ax = plt.gca() my_thread = ThreadFrame() my_thread.start() my_thread.setup() plt.show()
Is there something I have to do differently with threads? Or is there another way to do this?
user671110
source share