[PyQt] issue with QPainter.drawPolyline and list of QPoints

Hans-Peter Jansen hpj at urpla.net
Wed Feb 1 00:25:57 GMT 2012

Hi Phil,

shouldn't this work:

from PyQt4 import QtCore, QtGui
app = QtGui.QApplication([])
pixmap = QtGui.QPixmap(16, 16)
painter = QtGui.QPainter(pixmap)
plist = [QtCore.QPoint(0, 15), QtCore.QPoint(0, 0), QtCore.QPoint(15, 0)]

With PyQt 4.9, this results in:

TypeError: arguments did not match any overloaded call:
  QPainter.drawPolyline(QPointF, ...): argument 1 has unexpected type 'list'
  QPainter.drawPolyline(QPolygonF): argument 1 has unexpected type 'list'
  QPainter.drawPolyline(QPoint, ...): argument 1 has unexpected type 'list'
  QPainter.drawPolyline(QPolygon): argument 1 has unexpected type 'list'
QPaintDevice: Cannot destroy paint device that is being painted

although you provide a %MethodCode handler for the list of QPoints case.
Ref: line 354 in sip/QtGui/qpainter.sip


More information about the PyQt mailing list