Advertisement
here2share

# js_radialgradient.py

Nov 25th, 2019
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. # js_radialgradient.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="500">
  12.  <defs>
  13.    <radialGradient id="grad1" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
  14.      <stop offset="0%" style="stop-color:rgb(255,255,255);
  15.      stop-opacity:0" />
  16.      <stop offset="100%" style="stop-color:rgb(0,0,255);stop-opacity:1" />
  17.    </radialGradient>
  18.  </defs>
  19.  <ellipse cx="200" cy="70" rx="85" ry="55" fill="url(#grad1)" />
  20. </svg>
  21.  
  22. </body>
  23. </html>'''
  24.  
  25. chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
  26.  
  27. tf = tempfile.mktemp(".html", "JSdemo_")
  28. print tf
  29. with open(tf, 'w') as temp:
  30.     temp.write(js_data)
  31. webbrowser.get(chrome_path).open(tf)
  32. os.remove(tf)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement