SVG in pyGTK

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Laharl
    Recognized Expert Contributor
    • Sep 2007
    • 849

    SVG in pyGTK

    I have an SVG file that's stored as data in an associated XML file, and I need to display the SVG. However, since the SVG is loaded from the XML, it's currently in the program as a string. Is there any way to display the image without saving it in a temporary file? I've tried to inherit from StringIO to make a file-like object, but gtk.gdk.pixbuf_ new_from_file only takes the file name, as do similar GTK functions, and new_from_data wants RGB data, as does new_from_array. Is there a way to pass in a string that says 'Redirect the file stuff to this StringIO object'?

    Storing the filepath to the image is a thought, though we have to parse the XML file anyway for other information. We'd really like to minimize our file accesses wherever possible, as our target machines have pretty poor specs.

    Sample XML file:
    [CODE=xml]
    <goal>
    <svgblock>
    svg data here
    </svgblock>
    ...
    </goal>
    [/CODE]
  • Smygis
    New Member
    • Jun 2007
    • 126

    #2
    i have no idea.

    How do i delete this post now...
    Last edited by Smygis; May 2 '08, 02:45 PM. Reason: I WAS WRONG!

    Comment

    • Laharl
      Recognized Expert Contributor
      • Sep 2007
      • 849

      #3
      Thanks anyway, we've solved the problem by using PixbufLoader (or at least made it less messy...).

      Comment

      Working...