def mprint(self): printer = QPrinter(QPrinter.HighResolution) docName = "Humm" #self.d_plot.title().text() #if ( not docName.isEmpty() ): #docName.replace ( QRegExp ( QString.fromLatin1 ( "\n" ) ), tr ( " -- " ) ) printer.setDocName(docName) printer.setCreator("Bode example") printer.setOrientation(QPrinter.Landscape) dialog = QPrintDialog(printer) if (dialog.exec_()): renderer = Qwt.QwtPlotRenderer() if (printer.colorMode() == QPrinter.GrayScale): renderer.setDiscardFlag(Qwt.QwtPlotRenderer.DiscardBackground) renderer.setDiscardFlag( Qwt.QwtPlotRenderer.DiscardCanvasBackground) renderer.setDiscardFlag(Qwt.QwtPlotRenderer.DiscardCanvasFrame) renderer.setLayoutFlag(Qwt.QwtPlotRenderer.FrameWithScales) renderer.renderTo(self.d_plot, printer)
def exportChart(self): renderer = Qwt.QwtPlotRenderer() renderer.exportTo(self, "barchart.pdf")