Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # js_lineargradient.py
- import tempfile
- import webbrowser
- import os
- js_data = '''<!DOCTYPE html>
- <html>
- <body>
- <svg height="150" width="400">
- <defs>
- <linearGradient id="grad3" x1="0%" y1="0%" x2="100%" y2="0%">
- <stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" />
- <stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
- </linearGradient>
- </defs>
- <ellipse cx="200" cy="70" rx="85" ry="55" fill="url(#grad3)" />
- <text fill="#ffffff" font-size="45" font-family="Verdana" x="150" y="86">
- SVG</text>
- </svg>
- </body>
- </html>'''
- chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
- tf = tempfile.mktemp(".html", "JSdemo_")
- print tf
- with open(tf, 'w') as temp:
- temp.write(js_data)
- webbrowser.get(chrome_path).open(tf)
- os.remove(tf)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement