I'm currently working on a GUI application using Python PySide6. PySide 6 is the official GUI interface for the PyQt project. It is based on the Qt Framework providing a way to make fully feature GUI applications in Python 3. I used the QGraphicsView and QGraphicsScene to provide a widget where I could draw objects using regular shapes (such as rects, polygons and lines). I also wanted the ability to move objects, group objects, and zoom in and out.
There is not much community documentation which explains it, so I've created this as a brief guide. It explains how to create a QGraphicsView and QGraphicsScene and how to populate it with different shapes. The QGraphicsScene automatically adds scrollbars as required. The video then shows how these can be made into movable objects and how groups can be used to combine shapes. I then show how it is possible to use the Mouse Scroll Wheel along with the Control Key to be able to zoom in and out.
For more details see https://www.penguintutor.com/programm...
Chapters:
00:00 Introduction
02:18 What are QGraphicsView and QGraphicsScene
05:17 Creating QGraphicScene example
07:34 Drawing shapes on the GUI
14:17 Grouping items in QGraphicsScene
16:28 Zooming in PySide6 with QGraphicsScene