Displaying SVG in tkinter using cairo and rsvg

Arndt Roger Schneider arndt.roger at addcom.de
Wed Feb 16 12:00:30 CET 2011


Martin P. Hellwig schrieb:
> On 02/16/11 09:04, Arndt Roger Schneider wrote:

[snip]

> tkpath does not seem to come standard with Python's tk version when I 
> looked into it a couple of years ago, but maybe it has now?
> 
tk canvas and tkpath share the same interface, the first tkpath was
a plugin into the tk canvas. A tkinter wrapper class will
be a simple subclass of tk canvas introducing the new item types:
path, ppolygone, polyline, circle, elipsis, pimage, prect, ptext, group 
and for tkpath 0.3 three
additional messages for: style, gradient and distance, that's all
~50 lines of code.

>> Is there anyting else You want to know about svg?
>>
> 
> No not really :-), I just wanted to display a SVG in tkinter with the 
> minimal amount of external dependencies, since I have achieved that I 
> thought I share my experience, so that the next time someone google 
> tkinter and display svg it will return something that (well at least of 
> the time of this writing) worked.
> 

Well CAIRO is sort of a shifting target...
--currently I am stuck with PPC and new CAIRO versions cannot longer
being built on it anymore :-(--

CAIRO can be real pain on non-X11-linux platforms. ImageMagick
is simpler than CAIRO cross-platform wise.

-roger



More information about the Python-list mailing list