From c500a97fa6499cbcc22b2d366768a839f805cb9c Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Thu, 29 Sep 2022 20:31:36 +0200 Subject: [PATCH] A simple test of using QGraphicsScene I use this mainly for reference, which Q-class is in which module. --- snippets/qt_graphics.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 snippets/qt_graphics.py diff --git a/snippets/qt_graphics.py b/snippets/qt_graphics.py new file mode 100755 index 0000000..8ccec26 --- /dev/null +++ b/snippets/qt_graphics.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +from PySide6 import QtCore, QtGui, QtWidgets + + +class Window(QtWidgets.QWidget): + def __init__(self): + super().__init__() + + scene = QtWidgets.QGraphicsScene() + rect = scene.addRect(QtCore.QRectF(100,100,100,100), + pen=QtGui.QPen(QtGui.QColor('red')), + brush=QtGui.QBrush(QtGui.QColor('yellow')), + ) + view = QtWidgets.QGraphicsView(scene) + self.scene = scene + self.view = view + self.rect = rect + view.show() + +app = QtWidgets.QApplication([]) +win = Window() +#win.show() + +app.exec()