From: Matt N. <new...@ca...> - 2005-03-30 20:57:54
|
Kosta, > I'm trying to embed matplotlib on WX (which seems to work well for the > moment). I'd like to avoid the wx mainloop() by making it run in a > different thread than that of my main program. > > The classical way of doing (using show() ) doesn't work. The > first time, the figure becomes the main thread and my program > stops running until I close the window. The second time I call > it though, my program remains the main thread... Check the > following code Hmm, could you explain why you want to avoid the wx mainloop, and what you mean by this. Do want wx to process events, right? You say you're trying to embed matplotlib on WX, but the code you posted doesn't do this. It uses pylab, which creates a wx App and runs its mainloop when you do show(). My guess is that you're probably start getting the behavior you expect once that auto-created wxapp is killed. A simple answer would be to not use pylab, and just use a matplotlib FigureCanvas with wx. You'd have a mainloop then (I don't see how you avoid that!!). You could start another thread for non-GUI processing if you wanted, or *use* the mainloop's events (timers or data-changing events) to update the plot. Hope that helps, --Matt |