Hi,
I have a problem with matplotlib:
My program is an interective simulator which needs to re-plot results multiple times at the users request.
But after I issue show() I cannot generate other plots.
what can I do to circumvent this?
thanks in advance,
Flávio Codeço Coelho, PhD
Programa de Computação Científica
Fundação Oswaldo Cruz
Rio de Janeiro – Brasil
···
I think you need to use threads. I'm only just learning how to use them
myself. But have a look at:
http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq20.001.htp
and play with something like:
#!/usr/bin/python
# Trying to figure out how to use threads.
# This doesn't work, but I feel it is close.
import time
import thread
from matplotlib.matlab import *
import gtk
gtk.threads_init()
# gtk.mainloop()
figure(1)
plot([1,2,3,4,5,2])
print "figure 1"
gtk.threads_enter()
thread.start_new_thread(show, ())
gtk.threads_leave()
time.sleep(2)
figure(2)
plot([1,2,3,4,5,2,10])
print "figure 2"
gtk.threads_enter()
thread.start_new_thread(show, ())
gtk.threads_leave()
time.sleep(2)
...
Cheers,
Matthew.
···
On Thu, 8 Jan 2004, Flavio C. Coelho wrote:
Hi,
I have a problem with matplotlib:
My program is an interective simulator which needs to re-plot results
multiple times at the users request.
But after I issue show() I cannot generate other plots.
what can I do to circumvent this?
thanks in advance,
Fl�vio Code�o Coelho,
PhD
Programa de Computa��o
Cient�fica
Funda��o Oswaldo Cruz
Rio de Janeiro -- Brasil
________________________________________________________________________