From: Alexander B. <vo...@ua...> - 2009-07-17 17:37:42
|
Hi, list! I have a problem with embedding matplotlib in Qt based GUI. I read manual and look at example "embedding_in_qt4.py". I create GUI with QtDesigner. For matplotlib plot I create a QWidget. Then in runtime I embed a matplotlib plot im my GUI, into this QWidget. Here some code: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure class dlgStatist( QDialog, Ui_dlgStatistics ): def __init__( self, iface ): QDialog.__init__( self ) self.iface = iface self.setupUi( self ) # prepare figure self.figure = Figure() #self.figure.set_figsize_inches( ( 4.3, 4.2 ) ) self.axes = self.figure.add_subplot( 111 ) self.figure.suptitle( "Frequency distribution", fontsize = 12 ) self.axes.grid( True ) self.canvas = FigureCanvas( self.figure ) self.canvas.setParent( self.widgetPlot ) ....... All looks fine, but when user change window size, matplotlib plot doesn't resized. I try to set SizePolicy to matplotlib figure (as explained in example) but this don't help. Where is my mistake and can anyone give me a little example how to embed matplotlib plot in GUI created with QtDesigner? I really need resizible plot into Qt dialog. Sorry for my bad English, I'm Ukrainian. Python 2.5.4 PyQT 4.4.3 numpy 1.3.0 matplotlib 0.98.5.3 Alexander Bruy -- реклама ----------------------------------------------------------- Создай свой сайт бесплатно! www.hostpro.ua |