> 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/property-getters-and-setters.md).

# Property Getting and Setting

## Property Getting

`object.property_name`

To get any property from an Easy Draw object, simply use the variable name of storing the object dot the name of the property.&#x20;

Example:  Getting the `radius` property from a Regular Polygon object named `pentagon`&#x20;

```python
pentagon.radius
```

Example:  Getting the `color` property from a Text object named `title`

```python
title.color
```

## Property Setting

`object.set_property(property_name = new_value)`

To set a property to a new value, you must call the `.set_property()` method on the object you want to change, identifying the property you want to change and its new value.

Example:  Changing the `text` property of a Text object named `title`

```python
title.set_property(text = "Player 1 has selected a character...")
```

Example:  Changing the `width` property of a Rectangle object named `box`

```python
box.set_property(width = 200)
```

## Examples

In this example we will create a square with a random color and an octagon with default color, `"black"`.  Whenever the octagon is clicked, its color will change to the square's color.

To do this, we need to get the `color` property of the square and set the `color` property of the octagon.

Get the square's color property -- `square.color`

Set the octagon's property -- `octagon.set_property()`

```python
import easy_draw
import random

easy_draw.load_canvas()

square = easy_draw.Rectangle(
    xy = (100, 100), 
    width = 200, 
    height = 200,
    color = random.choice(["blue", "red", "yellow", "green", "orange", "purple"])
)

octagon = easy_draw.RegPolygon(
    center_xy=(400,400),
    radius=100, 
    nsides=8
)

def click_octagon(event):
    global square
    global octagon
    octagon.set_property(color = square.color)

square.event_setup("<Button-1>", click_octagon)

easy_draw.end()
```

In this example, we create a growing circle by increasing the circle's radius by 10 each time it is clicked.&#x20;

Notice how the Circle object's `radius` property is set to the current `cir.radius` plus 10.&#x20;

```python
import easy_draw

easy_draw.load_canvas()

cir = easy_draw.Circle(
    center_xy = (300, 300),
    radius = 20
)

def click_circle(event):
    global cir
    cir.set_property(radius = cir.radius + 10)

cir.event_setup("<Button-1>", click_circle)

easy_draw.end()
```
