Canvas Example

Spring 2020

You are not logged in.

If you are a current student, please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.csail.mit.edu) to authenticate, and then you will be redirected back to this page.

Remember you can return any string you want from your Python request_handler function including valid html, which means you can take advantage of any sort of html stuff.

Consider this test page I have up now:

http://608dev.net/sandbox/sc/yuyu/canvas_test/example.py

This is currently a drawing served by the following code:

canvas_example.py

You can do the same thing with literally any html/javascript you'd like. You can also store it in separate files and then read in the files (using your relative home directory path names) and then render those files as strings.

Details on how to work with html graphics are found here and we can always help on piazza and in office hours

https://www.w3schools.com/graphics/canvas_text.asp

Also consider using a DOM-based graphics implementation like SVG (I prefer this over Canvas, but if you're rendering a lot of stuff, canvas is probably better for speed).