On Fri, Jun 11, 2010 at 12:36 AM, David Ripton <[email protected]> wrote:
> Cairo is basically immediate mode.  Which means you need to redraw
> everything in the exposed area every time.  A canvas is retained mode.
> Meaning you build some objects that know how to redraw themselves every
> time they are exposed, with support for placing them and possibly
> overlapping them and only drawing what's on top.  If your drawing is
> simple enough then it's easier to just use Cairo; the more objects you
> throw onto the screen, the more sense it makes to use a full canvas to
> subdivide the work so you don't end up with a gigantic unmaintainable
> draw method.
>
> I needed a canvas that would work well with the old versions of
> libraries on RHEL 5 and not have license problems, and couldn't find one
> (GnomeCanvas didn't let me rescale things well, GooCanvas didn't work
> well for me for some reason I've forgotten and was also a pain to build,
> the one from OLPC was GPL licensed), so I wrote my own.  Basically
> inherits from DrawingArea and does Cairo calls in the draw methods.  The
> canvas is only 850 lines of Python, but it's the kind of fiddly
> lower-level GUI code that's a pain to write.  There are classes for
> rectangles, lines with arrows on the ends of them (which require some
> trig to draw correctly), SVG images (rsvg module), text (pango and
> pangocairo).  A general-purpose canvas library would have more stuff,
> but that's all I needed.  Performance is fine for a small number of
> displayed objects but doesn't scale well to hundreds of objects.  I'd
> like to obsolete this code when we can switch to RHEL 6.
>
> I highly recommend reusing one of the existing canvases rather than
> writing your own if at all possible.

Thanks for explaining David. Let me see how my app goes.

-- 
:J
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to