Advertisement
here2share

# js_strokes.py

Nov 25th, 2019
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.11 KB | None | 0 0
  1. # js_strokes.py
  2.  
  3. import tempfile
  4. import webbrowser
  5. import os
  6.  
  7. js_data = '''<!DOCTYPE html>
  8. <html>
  9. <body>
  10.  
  11. <svg height="600" width="300">
  12.  <g fill="none">
  13.    <path stroke="red" d="M5 20 l215 0" />
  14.    <path stroke="black" d="M5 40 l215 0" />
  15.    <path stroke="blue" d="M5 60 l215 0" />
  16.  </g>
  17.    
  18.  <g fill="none" stroke="black">
  19.    <path stroke-width="2" d="M5 100 l215 0" />
  20.    <path stroke-width="4" d="M5 120 l215 0" />
  21.    <path stroke-width="6" d="M5 140 l215 0" />
  22.  </g>
  23.  
  24.  <g fill="none" stroke="black" stroke-width="6">
  25.    <path stroke-linecap="round" d="M5 180 l215 0" />
  26.  </g>
  27.  
  28.  <g fill="none" stroke="black" stroke-width="4">
  29.    <path stroke-dasharray="5,5" d="M5 220 l215 0" />
  30.    <path stroke-dasharray="10,10" d="M5 240 l215 0" />
  31.    <path stroke-dasharray="20,10,5,5,5,10" d="M5 260 l215 0" />
  32.  </g>
  33.    
  34. </svg>
  35.  
  36. </body>
  37. </html>'''
  38.  
  39. chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
  40.  
  41. tf = tempfile.mktemp(".html", "JSdemo_")
  42. print tf
  43. with open(tf, 'w') as temp:
  44.     temp.write(js_data)
  45. webbrowser.get(chrome_path).open(tf)
  46. os.remove(tf)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement