You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
birdvisu/snippets/qt_graphics.py

26 lines
522 B
Python

#!/usr/bin/env python3
from PySide2 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()