Advertisement
here2share

# js_lineargradient.py

Nov 25th, 2019
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. # js_lineargradient.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="150" width="400">
  12.  <defs>
  13.    <linearGradient id="grad3" x1="0%" y1="0%" x2="100%" y2="0%">
  14.      <stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" />
  15.      <stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
  16.    </linearGradient>
  17.  </defs>
  18.  <ellipse cx="200" cy="70" rx="85" ry="55" fill="url(#grad3)" />
  19.  <text fill="#ffffff" font-size="45" font-family="Verdana" x="150" y="86">
  20.  SVG</text>
  21. </svg>
  22.  
  23. </body>
  24. </html>'''
  25.  
  26. chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
  27.  
  28. tf = tempfile.mktemp(".html", "JSdemo_")
  29. print tf
  30. with open(tf, 'w') as temp:
  31.     temp.write(js_data)
  32. webbrowser.get(chrome_path).open(tf)
  33. os.remove(tf)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement