[SciPy-user] call plt.image from a wx GUI?
prabhu at aero.iitm.ernet.in
Thu Aug 1 11:23:59 CDT 2002
>>>>> "AF" == Adam C Finnefrock <finnefro at sas.upenn.edu> writes:
>>>> import gui_thread
<Importing wxPython... done.>
>>>> import wxCCD proxy_class =
>>>> gui_thread.register(wxCCD.MainWindow) win = proxy_class()
AF> Now the GUI starts without tying up the command line.
AF> I'd like the GUI to display some data in another window, so it
AF> calls plt.image(scaled_data,None,None,colormap,'no') which
AF> A simple call to plt.plot([1,2,3],[4,5,6]) does that same.
I thought that this used to work. There is obviously some threading
issue here. Check to see if a proxied class is really created when
you call the plt.plot function. It could also be that a proxied class
is not created because the call is executed inside a proxy event. And
once the function call is done there is a threading problem. I guess
what I'm saying doesnt make any sense to you. Its just that
gui_thread can get fairly complex. I ran a test case and got
segfaults when I created a plot but the segfault occured only when I
closed the window. Wierd. I dont have the time now to check it out.
If I do get to doing it I'll see. However for now you can use the
plot code from your code by doing something like so:
def __init__(self, blah, blah):
# add this next line somewhere in your constructor or whereever
# you pack your gui elements.
self.plotter = plt.plot_canvas(self, size=wxSize(250,250),
def plot(self, x, y):
""" Use this to plot. """
self.plotter.line_list.data = 
lines = 
for i in lines:
This way you use the basic widget from the plt code inside yours and
all this code should be proxied properly.
I'll try and understand the gui_thread issue when I get some spare
More information about the SciPy-user