aboutsummaryrefslogtreecommitdiffstats
path: root/examples/widgets/effects/lighting/lighting.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/effects/lighting/lighting.py')
-rw-r--r--examples/widgets/effects/lighting/lighting.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/examples/widgets/effects/lighting/lighting.py b/examples/widgets/effects/lighting/lighting.py
index ec8f945e1..be34464dd 100644
--- a/examples/widgets/effects/lighting/lighting.py
+++ b/examples/widgets/effects/lighting/lighting.py
@@ -89,11 +89,10 @@ class Lighting(QGraphicsView):
pixmap = QPixmap(60, 60)
pixmap.fill(Qt.transparent)
- painter = QPainter(pixmap)
- painter.setPen(Qt.NoPen)
- painter.setBrush(radial_grad)
- painter.drawEllipse(0, 0, 60, 60)
- painter.end()
+ with QPainter(pixmap) as painter:
+ painter.setPen(Qt.NoPen)
+ painter.setBrush(radial_grad)
+ painter.drawEllipse(0, 0, 60, 60)
self.m_lightSource = self.m_scene.addPixmap(pixmap)
self.m_lightSource.setZValue(2)