# Drawing Shapes

When drawing shapes, the sequence matters. That is how the layering system works.

The first object in sequence that is drawn in your code will be at the bottom most layer of your drawing.  The last object in sequence that is drawn in your code will be the top most layer of your drawing.

## Rectangle

`Rectangle(xy, width, height)`

![](/files/-MR_brBio-EXXyHCGBw8)

| **Property**   | D**efault Value**     | **Description**                                                                              |
| -------------- | --------------------- | -------------------------------------------------------------------------------------------- |
| `xy`           | REQUIRED (No default) | The x and y coordinate of the rectangle's top-left corner as a tuple.                        |
| `width`        | REQUIRED (No default) | The width of the rectangle in pixels.                                                        |
| `height`       | REQUIRED (No default) | The height of the rectangle in pixels.                                                       |
| `color`        | "black"               | RGB tuple color value, hexadecimal color value, or string containing color name can be used. |
| `border_color` | None                  | Color of the border.                                                                         |
| `border_width` | 0                     | Size of the border in pixels.                                                                |
| `dashes`       | None                  | Size of the dashes for the border in pixels.                                                 |
| `visible`      | True                  | <p>True = Shape can be seen. </p><p>False = Shape cannot be seen.</p>                        |

Example:

```python
rect1 = easy_draw.Rectangle(
    xy = (300, 300), 
    width = 200, 
    height = 150,
    color = (255, 0, 0),          # Optional Property
    border_color = (0, 0, 0),     # Optional Property
    border_width = 10,            # Optional Property
    dashes = 25                   # Optional Property
    visible = True                # Optional Property
)
```

## Regular Polygon

`RegPolygon(nsides, center_xy, radius)`

![](/files/-MR_cru4Phqg61haLd1f)

| Property       | Default Value         | Description                                                                                  |
| -------------- | --------------------- | -------------------------------------------------------------------------------------------- |
| `nsides`       | REQUIRED (No default) | The number of sides the polygon has.                                                         |
| `center_xy`    | REQUIRED (No default) | The x and y coordinate of the polygon's center as a tuple.                                   |
| `radius`       | REQUIRED (No default) | The distance in pixels from the center to any outer point.                                   |
| `color`        | "black"               | RGB tuple color value, hexadecimal color value, or string containing color name can be used. |
| `border_color` | None                  | Color of the border.                                                                         |
| `border_width` | 0                     | Size of the border in pixels.                                                                |
| `dashes`       | None                  | Size of the dashes for the border in pixels.                                                 |
| `visible`      | True                  | <p>True = Shape can be seen. </p><p>False = Shape cannot be seen.</p>                        |

Example:

```python
reg_poly1 = easy_draw.RegPolygon(
    nsides = 8,
    center_xy = (300, 300), 
    radius = 100, 
    color = (255, 0, 0),      # Optional Property
    border_color = (0, 0, 0), # Optional Property
    border_width = 10,        # Optional Property
    dashes = 25               # Optional Property
)
```

## Polygon

`Polygon(points_list)`

![](/files/-MR_fjwaZO4mP9XlS2rC)

*The above image is just an example.  The Polygon can have as many sides as you want, and is dependent on the number of xy coordinates you provide.*&#x20;

| Property       | Default Value         | Description                                                                                               |
| -------------- | --------------------- | --------------------------------------------------------------------------------------------------------- |
| `points_list`  | REQUIRED (No default) | A list of x y coordinates identifying the points of the polygon. List must have an even number of values. |
| `color`        | "black"               | RGB tuple color value, hexadecimal color value, or string containing color name can be used.              |
| `border_color` | None                  | Color of the border.                                                                                      |
| `border_width` | 0                     | Size of the border in pixels.                                                                             |
| `dashes`       | None                  | Size of the dashes for the border in pixels.                                                              |
| `visible`      | True                  | <p>True = Shape can be seen. </p><p>False = Shape cannot be seen.</p>                                     |

The `points_list` property MUST have an even number of values.  It must consist of xy pairs for each point.&#x20;

Example:

```python
poly1 = easy_draw.Polygon(
    points_list = [25, 25, 150, 25, 200, 200, 100, 250, 25, 200], 
    color = (255, 0, 0),       # Optional Property
    border_color = (0, 0, 0),  # Optional Property
    border_width = 10,         # Optional Property
    dashes = 25                # Optional Property
)
```

## Line

`Line(xy1, xy2)`

![](/files/-MU-ZaAMGoIFqzFnz8El)

OR

`Line(points_list)`

![](/files/-MU-ZJGBV1J0VGjttyKV)

| Property      | Default Value                                             | Description                                                                                            |
| ------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `xy1`         | REQUIRED if `points_list` is not provided (No default)    | The starting xy coordinate of the line as a tuple.                                                     |
| `xy2`         | REQUIRED if `points_list` is not provided (No default)    | The ending xy coordinate of the line as a tuple.                                                       |
| `points_list` | REQUIRED is `xy1` and `xy2` are not provided (No default) | A list of x y coordinates identifying the points of the line. List must have an even number of values. |
| `color`       | "black"                                                   | RGB tuple color value, hexadecimal color value, or string containing color name can be used.           |
| `thickness`   | 5                                                         | The width of the line.                                                                                 |
| `dashes`      | None                                                      | Size of the dashes for the border in pixels.                                                           |
| `arrow_start` | False                                                     | Add an arrow to the start of the line.                                                                 |
| `arrow_end`   | False                                                     | Add an arrow to the end of the line.                                                                   |
| `style`       | "round"                                                   | Set property to `"round"` for round edges and joints and `"cut"` for squared/cut-off edges and joints. |
| `visible`     | True                                                      | <p>True = Shape can be seen. </p><p>False = Shape cannot be seen.</p>                                  |

Example:

```python
line1 = easy_draw.Line(
    xy1 = (100, 100), 
    xy2 = (200, 200),
    thickness = 8,          # Optional Property
    color = (255, 0, 0),    # Optional Property
    dashes = 25             # Optional Property
)

# OR

line1 = easy_draw.Line(
    points_list = [],
    thickness = 8,          # Optional Property
    color = (0, 255, 0),    # Optional Property
    dashes = 25,            # Optional Property
    style = "cut"           # Optional Property
)
```

## Circle

`Circle(center_xy, radius)`

![](/files/-MR_i0W_lHdud28t__p9)

| Property       | Default Value         | Description                                                                                  |
| -------------- | --------------------- | -------------------------------------------------------------------------------------------- |
| `center_xy`    | REQUIRED (No default) | The center coordinate (x, y) of the circle.                                                  |
| `radius`       | REQUIRED (No default) | The measurement in pixels from the center of the circle to the edge.                         |
| `color`        | "black"               | RGB tuple color value, hexadecimal color value, or string containing color name can be used. |
| `border_color` | None                  | Color of the border.                                                                         |
| `border_width` | 0                     | Size of the border in pixels.                                                                |
| `dashes`       | None                  | Size of the dashes for the border in pixels.                                                 |
| `visible`      | True                  | True = Shape can be seen. False = Shape cannot be seen.                                      |

Example:

```python
cir1 = easy_draw.Circle(
    center_xy = (300, 300), 
    radius = 100, 
    color = (255, 0, 0),          # Optional Property
    border_color = (0, 0, 0),     # Optional Property
    border_width = 10,            # Optional Property
    dashes = 25                   # Optional Property
)
```

## Oval

`Oval(center_xy, width, height)`

![](/files/-MR_ioK19DUZDAWjeepO)

| Property       | Default Value         | Description                                                                                  |
| -------------- | --------------------- | -------------------------------------------------------------------------------------------- |
| `center_xy`    | REQUIRED (No default) | The center coordinate (x, y) of the oval.                                                    |
| `width`        | REQUIRED (No default) | The measurement in pixels of the left edge to the right edge of the oval.                    |
| `height`       | REQUIRED (No default) | The measurement in pixels of the top edge to the bottom edge of the oval.                    |
| `color`        | "black"               | RGB tuple color value, hexadecimal color value, or string containing color name can be used. |
| `border_color` | None                  | Color of the border.                                                                         |
| `border_width` | 0                     | Size of the border in pixels.                                                                |
| `dashes`       | None                  | Size of the dashes for the border in pixels.                                                 |
| `visible`      | True                  | <p>True = Shape can be seen. </p><p>False = Shape cannot be seen.</p>                        |

Example:

```python
oval1 = easy_draw.Oval(
    center_xy = (300, 300), 
    width = 100, 
    height = 200, 
    color = (255, 0, 0),       # Optional Property
    border_color = (0, 0, 0),  # Optional Property
    border_width = 10,         # Optional Property
    dashes = 25                # Optional Property
)
```

## Arc

`Arc(center_xy, width, height, sweep_angle)`

![](/files/-MR_nS8Sjg0QA5oZFX7U)

There are 3 different styles:

![](https://tkdocs.com/shipman/img/chord.png)

*Note: The "arc" style uses the `border_color` and `border_width` only.*&#x20;

| Property       | Default Value         | Description                                                                                  |
| -------------- | --------------------- | -------------------------------------------------------------------------------------------- |
| `center_xy`    | REQUIRED (No default) | The center coordinate (x, y) of the circle used to create the arc.                           |
| `width`        | REQUIRED (No default) | The width of the circle used to create the arc.                                              |
| `height`       | REQUIRED (No default) | The height of the circle used to create the arc.                                             |
| `sweep_angle`  | REQUIRED (No default) | The amount of the arc to show. From 0 to the angle in degrees identified.                    |
| `color`        | "black"               | RGB tuple color value, hexadecimal color value, or string containing color name can be used. |
| `border_color` | None                  | Color of the border.                                                                         |
| `border_width` | 0                     | Size of the border in pixels.                                                                |
| `dashes`       | None                  | Size of the dashes for the border in pixels.                                                 |
| `style`        | "pieslice"            | The arc comes in three styles choices: "pieslice", "chord", and "arc"                        |
| `visible`      | True                  | True = Shape can be seen. False = Shape cannot be seen.                                      |

Example:

```python
arc1 = easy_draw.Arc(
    center_xy = (300, 300), 
    width = 100, 
    height = 100, 
    sweep_angle = 90,
    style = "chord",           # Optional Property
    color = (255, 0, 0),       # Optional Property
    border_color = (0, 0, 0),  # Optional Property
    border_width = 10,         # Optional Property
    dashes = 25                # Optional Property
) 
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://easy-draw.joemazzone.net/python/module-reference/drawing-shapes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
