def save(self, filename = None): """ Save the SVG If no filename is given the same file that was loaded is used """ if filename: outfile = file(filename, "w") else: outfile = file(self.__filename, "w") print_svg(self, outfile)
def __str__(self): """ Return the SVG's XML in a string """ class SVGString: def __init__(self): self.string = '' def write(self, data): self.string += str(data) svg = SVGString() print_svg(self, svg) return svg.string