For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Starter Template

To start drawing with Easy Draw, all you need is three lines of code. It is that easy!

# Learn how to use Easy Draw!
# https://easy-draw.joemazzone.net/python/module-reference

import easy_draw           # Import the module to use it

easy_draw.load_canvas()    # Always start your program with this

# --- Your main program below here ---



# --- Your main program ends here ---

easy_draw.end()            # Always end your program with this

When you run the program above, Easy Draw opens your drawing in your web browser at http://localhost:8765/.

Easy Draw also writes your drawing to an index.html file in the same folder as your program. Open index.html any time to see your drawing again.

While your program is running, clicks, mouse movement, and key presses in the browser are sent to your event handlers. The badge in the top-right corner of the page says Live when the page is connected to your program and Offline when it is not.

Close the browser tab (or press Ctrl+C) to stop your program. Run your program again and the page goes live again.

Here is the Easy Draw page with a drawing on it and the grid turned on:

The Easy Draw page in a web browser

Features of the Easy Draw page:

1. Grid on and off

To help learners visualize the coordinate system, a grid can be turned on and off with the Grid button. The grid has a line every 50 pixels and numbers along the top and left side of the canvas.

2. Coordinates

To help learners position shapes on the drawing canvas, the bottom-right corner of the page shows the x, y coordinates of your mouse as you move it around the canvas.

3. Color Picker

To help learners identify color values to use in their code, they can open a color picker with the Color Picker button. When you choose a color, the page shows its hex and RGB values to use in your program.

Note: The color picker comes from your web browser and will look different in different browsers.

4. Save the Canvas Drawing

You can save your drawing as a PNG file by clicking the Save Canvas button. Just be sure to provide the image with a file name. Your browser downloads the picture, so it will be in your Downloads folder.

To save the picture in your project folder instead, see Saving Your Drawing.

Last updated

Was this helpful?