[PyQt] Use QPainter as QMutexLocker in a with-statement?

Gerard Vermeulen gav451 at gmail.com
Thu Jan 5 14:28:13 GMT 2012


Hi,

I would like to use QPainter as QMutexLocker in a with-statement, but:

 >>> pixmap = Qt.QPixmap(200, 200)
 >>> with Qt.QPainter(pixmap) as painter:
...  painter.drawLine(0, 0, 200, 200)
...
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
AttributeError: __exit__
 >>>

Gerard



More information about the PyQt mailing list