> For the complete documentation index, see [llms.txt](https://easy-draw.joemazzone.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://easy-draw.joemazzone.net/python/module-reference/the-drawing-canvas.md). Agents can also search and read this documentation through its [MCP server](https://easy-draw.joemazzone.net/~gitbook/mcp).

# The Drawing Canvas

All shapes will be drawn on a canvas.

The Easy Draw canvas is 600 x 600 pixels (600 pixels wide by 600 pixels tall). So (300, 300) is the middle of the canvas, and (600, 600) is the bottom-right corner.

The coordinate system origin (0, 0) is the top-left corner of the canvas.

As x increases, objects move right. As y increases, objects move down (not up!).

![](https://651142499-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MRAMSGwqRIdQ2ADsTkz%2F-MRSz1hx0nb7qnoNWat3%2F-MRT-Gv1H7yZTFGl5LLU%2Fimage.png?alt=media\&token=a4585fe9-c159-4731-8a5e-7929c28c2f13)

{% hint style="info" %}
Turn on the **Grid** button in the Easy Draw page to see the coordinates on the canvas.
{% endhint %}

## Loading the Canvas

`load_canvas()`

Every Easy Draw program must start with this function call. It writes your drawing to an `index.html` file in the same folder as your program and opens the live drawing in your web browser.

Load canvas has one optional argument - `background`. The background property allows you to identify a color value for the canvas on load.

Example:

```python
easy_draw.load_canvas(background = (255, 0, 0))
```

There are also two optional settings for the live drawing:

| Setting        | Default Value | Description                                                             |
| -------------- | ------------- | ----------------------------------------------------------------------- |
| `port`         | 8765          | The port for the live drawing, which opens at <http://localhost:8765/>. |
| `open_browser` | True          | Set to `False` if you want to open the page in your browser yourself.   |

Example:

```python
easy_draw.load_canvas(port = 8000, open_browser = False)
```

## **Changing the Background Color**

`set_canvas_color(color)`

Used to change the canvas background color at any point in the program.

Example:

```python
easy_draw.set_canvas_color(color = (0, 0, 255))
```

## Ending the Program

`end()`

Every Easy Draw program must end with this function call. It keeps your program running so the browser can send events (like clicks and key presses) to your program.

Closing the Easy Draw browser tab (or pressing Ctrl+C) stops your program.

```python
easy_draw.end()
```

To print the finished page's HTML code, use `print_html=True`:

```python
easy_draw.end(print_html = True)
```
