[cairo] pygoocanvas with rsvg and pycairo (cross post)

Bobby Powers bobbypowers at gmail.com
Mon Feb 8 17:19:34 PST 2010


On Sun, Jan 31, 2010 at 9:50 PM, donn <donn.ingle at gmail.com> wrote:
> Hi, I posted this to the goocanvas list, but there seems to be little
> activity over there and, being cairo-related, I thought I'd ask here
> instead.
>
> Is it possible to use rsvg to render an "Item" (or something) to the
> canvas that is actually drawn via rsvg? Something like this:
>
> ctx = canvas.create_cairo_context()
> svg = rsvg.Handle(file="test.svg")
> svg.render_cairo(ctx)

Yup, I did just that:
http://dev.laptop.org/git/activities/model/tree/opensim/visuals/widgets/cloud.py#n130

> Also, is it possible to use standard pycairo commands to draw stuff to
> the canvas or an item?
>
> Failing all that, is it possible to embed a GTK widget (like a drawing
> area) into the canvas (like they do buttons) and so have it reflect what
>  is drawn to that context?

I found goocanvas to be a pain (and unmaintained).  I also don't think
it supports embedding a gtk widget in the canvas.

> On a related note -- what are the canvas/scene-graph options available
> for Python + Cairo (at least on Linux)?

I found Gaphas nice, if a bit obtuse to get started with [1].  It
supports embedding gtk widgets on the canvas, although I think zoom
and a lot of transformations are disabled when you do that. I'm not
sure of many others (hippocanvas actually, but I don't think that is
actively worked on), but I'd be interested in hearing what else is out
there.

Bobby

1 - http://github.com/amolenaar/gaphas
> \d
> --
> Fonty Python and Things! -- http://otherwise.relics.co.za/wiki/Software
>
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>


More information about the cairo mailing list