2009/1/19 Eduardo Willians <edujuri...@gmail.com>: > I searched a lot on google and stuff, but I wasn't able to find a code > example for printing with PyQt4. > > If know a tutorial or have a simple file.py that shows how to print > (through a printer) with PyQt4 please send me. > > Thanks. > > Eduardo Willians
Really sorry, I just found. I post it: <code> #!/usr/bin/env python """ Lets get the print thing working """ from PyQt4.QtGui import * from PyQt4.QtCore import * import PyQt4.QtWebKit as QtWebKit import sys class htmlViewer(QtWebKit.QWebView): def __init__(self,url, parent=None): QtWebKit.QWebView.__init__(self,parent) self.setUrl(QUrl(url)) self.preview = QPrintPreviewDialog() self.connect(self.preview,SIGNAL("paintRequested (QPrinter *)"),SLOT("print (QPrinter *)")) self.connect(self,SIGNAL("loadFinished (bool)"),self.execpreview) def execpreview(self,arg): print arg self.preview.exec_() if __name__=="__main__": app = QApplication(sys.argv) myurl = "http://www.google.com" widget = htmlViewer(myurl) widget.show() sys.exit(app.exec_()) </code> _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt