[SciPy-user] call plt.image from a wx GUI?

Adam C. Finnefrock finnefro at sas.upenn.edu
Tue Aug 6 12:37:12 CDT 2002


Prabhu Ramachandran <prabhu at aero.iitm.ernet.in> writes:


> 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),
>                                        title="Slicer")
> 
>      def plot(self, x, y):
>         """ Use this to plot. """
>         self.plotter.line_list.data = []
>         lines = []
>         lines.extend(plt.lines_from_group((x,y)))
>         for i in lines:
>             self.plotter.line_list.append(i)
>         self.plotter.update()


Thanks very much!  This worked well, and followed your example to add:


    def show_image(self, img, x=None, y=None, colormap='grey', scale='no'):
        """ Use this for images. """
        self.plotter.line_list.data = []
        self.plotter.image_list.data = []

        image = plt.wxplt.image_object(img,x,y,colormap=colormap,scale=scale)
        self.plotter.image_list.append(image)
        self.plotter.update()



Adam



More information about the SciPy-user mailing list