[PyKDE] Problems Printing on Windows with PyQt 2.1 and Python 2.0
Coy Krill
ckrill at qvlinc.com
Fri Oct 20 22:45:23 BST 2000
On Windows 98 and NT 4.0 the following program causes a segfault in QT221.DLL
when printing using Python 2.0 and PyQt 2.1. It works on Linux (Python 1.5.2
and PyQt2.1) and one Windows with Python 1.6 with PyQt2.0.
I don't think the problem is my simple code but I could be wrong.I don't know
where to begin to figure out if it's QT or PyQt that has a problem. Can
anyone else duplicate this problem? I've had it happen on three different
machines.
#!/usr/bin/env python
import sys
from qt import *
class DrawWidget(QWidget):
def __init__(self):
QWidget.__init__(self)
self.setCaption("Drawing Test")
self.setBackgroundColor(Qt.white)
self.resize(800,600)
self.printer = QPrinter()
self.x = 1
def drawIt(self,painter = None):
painter.drawRect(30,15,500,500)
painter.drawText(40,40,"THIS IS TEST TEXT")
def paintEvent(self,paintEvent):
paint =QPainter(self)
self.drawIt(paint)
if self.x == 1:
self.x = 2
self.printer.setPageSize(QPrinter.Letter)
self.printer.setOrientation(QPrinter.Portrait)
if self.printer.setup(self):
paint2 =QPainter(self.printer)
self.drawIt(paint2)
if __name__ == "__main__":
app = QApplication(sys.argv)
widget = DrawWidget()
app.setMainWidget(widget)
widget.show()
app.connect(app,SIGNAL('lastWindowClosed()'),app,SLOT('quit()'))
app.exec_loop()
Coy
More information about the PyQt
mailing list