To sum up: I want to open a frame in Python, be able to work with that frame, and also be able to continue using that terminal.
Basically, I'd like to mimic some Matlab behavior in Python. In Matlab, you can do:
x=0:10;
y=0:10;
plot(x,y)
and a plot will come up, be interactive, and you also have access to the terminal to change things and do other work.
I figured that in Python, if I threaded properly, I could do the same thing. However, the code below keeps control of 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 should be doing differently with the threading? Or is there another way to accomplish this?