Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # js_strokes.py
- import tempfile
- import webbrowser
- import os
- js_data = '''<!DOCTYPE html>
- <html>
- <body>
- <svg height="600" width="300">
- <g fill="none">
- <path stroke="red" d="M5 20 l215 0" />
- <path stroke="black" d="M5 40 l215 0" />
- <path stroke="blue" d="M5 60 l215 0" />
- </g>
- <g fill="none" stroke="black">
- <path stroke-width="2" d="M5 100 l215 0" />
- <path stroke-width="4" d="M5 120 l215 0" />
- <path stroke-width="6" d="M5 140 l215 0" />
- </g>
- <g fill="none" stroke="black" stroke-width="6">
- <path stroke-linecap="round" d="M5 180 l215 0" />
- </g>
- <g fill="none" stroke="black" stroke-width="4">
- <path stroke-dasharray="5,5" d="M5 220 l215 0" />
- <path stroke-dasharray="10,10" d="M5 240 l215 0" />
- <path stroke-dasharray="20,10,5,5,5,10" d="M5 260 l215 0" />
- </g>
- </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