12. Item-Based Graphics
If we create a custom widget and reimplement its paint event, we can draw any graphics we like. This approach was shown in the preceding chapter, and it is ideal for drawing custom widgets, for drawing graphs, and for drawing small numbers of items. But if we need to draw lots of independent items, anything from dozens to tens of thousands of them, or if we need to draw items that the user can interact with individually—for example, clicking, dragging, and selecting them—or if we need to animate items, PyQt’s graphics view classes are a much better choice than reimplementing a custom widget’s paint event.
The graphics view classes—QGraphicsView
, ...
Get Rapid GUI Programming with Python and Qt: The Definitive Guide to PyQt Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.