[PyQt] printing in Windows not working - tested on Vista 32 bits

Matteo Boscolo matteo.boscolo at boscolini.eu
Sun Jan 2 08:06:05 GMT 2011


this is the code that I use in my application to do the print of a 
QGraphicsView:

       printer=QtGui.QPrinter()
         printDialog=QtGui.QPrintDialog(printer)
         if (printDialog.exec_() == QtGui.QDialog.Accepted):
             painter=QtGui.QPainter()
             painter.begin(printer)
             painter.setRenderHint(QtGui.QPainter.Antialiasing);
             self.mdiArea.activeSubWindow().view.render(painter)
             painter.end()
         self.statusBar().showMessage("Ready")

and it works on win 7 64 bit

Hope it will be helpful for you
regards,
Matteo

Il 31/12/2010 18:17, Rodrigo ha scritto:
> Hello!
>
> I use (Ubuntu 64bit 10.10 + PyQt 2.7 + Python 4.8.2) and QPrintDialog 
> works perfectly. Including the ability to save in PDF. But when tested 
> on Windows Vista 32bits simply nothing appears, not even an error 
> message. The application works perfectly, but when calling the 
> QPrintDialog, nothing ...
>
> Already installed to the latest stable version of PyQt 4.8.2 on sight, 
> but still the same behavior. Has been there? Is it necessary for some 
> differentiation in the code that runs on windows? Already searched the 
> internet but did not.
>
>
> Thanks,
>
> Rodrigo
>
>
> My code:
> ------------------------------------------------------------------------
> def print(self, string):
>
>     printDialog = QPrintDialog(self.printer, self)
>
>     if printDialog.exec_():
>         filePrint = QTextDocument()
>         filePrint.setDefaultFont(QFont('Liberation Sans',10))
>         filePrint.setHtml(string)
>         filePrint.print_(self.printer)
> ------------------------------------------------------------------------
>
>
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
>
> Nessun virus nel messaggio.
> Controllato da AVG - www.avg.com <http://www.avg.com>
> Versione: 10.0.1191 / Database dei virus: 1435/3349 - Data di 
> rilascio: 30/12/2010
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110102/dac0ee5d/attachment-0001.html>


More information about the PyQt mailing list