[PyQt] need drawing application demo

Hans-Peter Jansen hpj at urpla.net
Thu Nov 19 16:04:29 GMT 2009

On Thursday 19 November 2009, 15:55:58 Mark Summerfield wrote:
> On 2009-11-19, Mitchell Model wrote:
> > I am just starting to do serious work with PyQt, having used many
> > other GUI/widget toolkits over the years. The rich collection of demos
> > and examples included in the installation -- apparently a large subset
> > of the ones in the Qt installation -- is impressive and very helpful.
> > I am surprised, however, by the absence of what to me is the canonical
> > demonstration, and one that I often program as my first exercise in a
> > new toolkit: a small drawing program. The program should offer a
> > palette of shapes (including lines), with the ability to place, move,
> > resize, delete, and duplicate a shape. Optional features like
> > specifying the color or size of the border and the color of the fill
> > are good too. Grouping, locking, anchoring lines to shapes, and Undo/
> > Redo/History would be even better.
> >
> > Surely a demo like this exists somewhere? Could someone point me to
> > one? (I am aware of the Diagram Scene example. It has some of what I
> > am looking for, but apparently no way to resize shapes using the
> > standard maneuver of grabbing a handle or corner and dragging).
> With Qt you really have two different ways you can implement a drawing
> program. One way is to create your own in-memory data structures and
> create a QWidget subclass where you paint everything yourself. Another
> way is to create a QGraphicsScene and populate it with QGraphicsItems.
> Which is best rather depends on what you want to achieve, although I
> think that using QGraphicsScene is easier.
> I present an example that does some of the things you're talking about
> in my PyQt book (chapter 13's Page Designer---in particular
> pagedesigner_ans.pyw). It uses QGraphicsScene and should be easy to
> extend to do all the things you mention. The book's examples can be
> downloaded from my web site.

and let me add, that even experienced with PyQt3 since a few years, Mark's 
book was tremendously helpful for me in grasping the new concepts of PyQt4. 
And to not forget to mention: in contrast to many (most) IT-books I read, 
Mark's book is a _real_ pleasure to read.


More information about the PyQt mailing list