Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # js_bezierCurveTo.py
- import tempfile
- import webbrowser
- import os
- js_data = '''<!DOCTYPE html>
- <html>
- <head>
- <title>HTML5 bezierCurveTo</title>
- </head>
- <body>
- <canvas id="myCanvas" width="500" height="200"
- style="border:1px solid blue;">
- </canvas>
- <script>
- var canvas = document.getElementById("myCanvas");
- var ctx = canvas.getContext("2d");
- ctx.beginPath();
- ctx.moveTo(100, 75);
- ctx.bezierCurveTo(200, 275, 300, -125, 400, 75);
- ctx.stroke();
- </script>
- </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