On Thu, 05 Jan 2012 15:28:13 +0100, Gerard Vermeulen <gav...@gmail.com> wrote: > 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__ > >>>
You would have to sub-class QPainter (in Python) and implement the necessary context manager hooks. Phil _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt