예제 #1
0
	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)
예제 #2
0
	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