From: Darren D. <dar...@co...> - 2008-02-23 17:09:59
|
On Saturday 23 February 2008 10:49:25 am John Hunter wrote: > On Fri, Feb 22, 2008 at 11:04 PM, sa6113 <s.p...@gm...> wrote: > > I could return the output object of the plot as image file , would you > > please tell me how I have to convert image to QImage in order to use it > > in my GUI ? > > I could, but this is a very poor way to do it. First, you would not > be able to interact with your figure (pan, zoom, etc). 2nd, you would > be using qimage to rescale your plot with the embedded window size an > this would be far inferior to having matplotlib draw into the > requested size. The right way to use this is to follow the example of > http://matplotlib.sourceforge.net/examples/embedding_in_qt4.py Yes, please follow the example John pointed out. The qt4agg backend already provides a widget that you can embed in your program, an example is in embedding_in_qt4.py, it does the conversion to a QImage already, you dont need to reimplement it. |