SmtC: Show me the Code
Ole Peter Smith
Instituto de Matemática e Estatística
Universidade Federal de Goiás
http://www.olesmith.com.br

SVG
Viver é algo que se faz agora ou nunca...
Qual você faz?
Piet Hein
< Example | Python | Line >

Generating SVG with Python:

Python Listing: SVG.py.
class SVG():
    def SVG_Options(self,options):
        if (not options): return ""
        
        html=[""]
        for key in options.keys():
            value=options[ key ]
            if (  options[ key ].__class__.__name__=="dict"  ):
                opts=[]
                for rkey in value.keys():
                    opts.append(   rkey+": "+str( value[ rkey] )   )

                value="; ".join(opts)
                else:
                    value=str(value)
            html.append(   key+'="'+value+'"'   )

        return " ".join(html)
    
    def SVG_Tag(self,tag,options={}):
        return "<"+tag+self.SVG_Options(options)+"/>\n"
    
    def SVG_Tags(self,tag,contents,options={}):
        return "\n".join([
            "<"+tag+self.SVG_Options(options)+">",
            contents,
            "</"+tag+">\n"
        ])
< Example | Python | Line >
Messages:
0 secs.