> For the complete documentation index, see [llms.txt](https://docs.pydraw.graphics/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pydraw.graphics/guides/quickstart.md).

# Quickstart Examples

## Example #1: Drawing

We can draw a simple emoji onto the screen with Ovals. We will mimic: ":hushed:" with a gray background.

```python
from pydraw import *

screen = Screen(800, 600)
screen.color(Color('gray'))

face = Oval(screen, 100, 0, 600, 600, Color('yellow'))
face.wedges(40)

eye1 = Oval(screen, 200, 200, 85.71, 100)
eye2 = Oval(screen, 500, 200, 85.71, 100)

eyebrow1 = Rectangle(screen, 157.14, 150, 100, 5, rotation=-16)
eyebrow2 = Rectangle(screen, 517.85, 150, 100, 5, rotation=16)

mouth = Oval(screen, 350, 400, 85.71, face.height() / 109)

screen.stop()
```

![Example #1 Output](/files/-MU9U36agmmayxE_h-lh)

{% hint style="info" %}
Note that we calculated those numbers using these formulas:

```python
eye1 = Oval(screen, face.x() + face.width() / 6, 200, face.width() / 7, face.height() / 6)
eye2 = Oval(screen, (face.x() + face.width()) - (face.width() / 6) * 2, 200, face.width() / 7, face.height() / 6)

eyebrow1 = Rectangle(screen, eye1.x() - eye1.width() / 2, 200 - 50, 100, 5, rotation=-16)
eyebrow2 = Rectangle(screen, eye2.x() - 25 + eye2.width() / 2, 200 - 50, 100, 5, rotation=16)
```

{% endhint %}

## Example #2: Animation

We can animate our face now by adding an animation loop and having our eyes blink every 3 seconds (note that we've now switched to the proportions-based calculations):

```python
from pydraw import *

screen = Screen(800, 600)
screen.color(Color('gray'))

face = Oval(screen, 100, 0, 600, 600, Color('yellow'))
face.wedges(40)

eye1 = Oval(screen, face.x() + face.width() / 6, 200, face.width() / 7, face.height() / 6)
eye2 = Oval(screen, (face.x() + face.width()) - (face.width() / 6) * 2, 200, face.width() / 7, face.height() / 6)

eyebrow1 = Rectangle(screen, eye1.x() - eye1.width() / 2, 200 - 50, 100, 5, rotation=-16)
eyebrow2 = Rectangle(screen, eye2.x() - 25 + eye2.width() / 2, 200 - 50, 100, 5, rotation=16)

mouth = Oval(screen, 400 - 50, 400, face.width() / 7, face.height() / 5.5)

count = 0
fps = 30
running = True
while running:
    seconds = count / fps

    if 1.9 < seconds < 2:
        eye1.height(1)
        eye2.height(1)
    if seconds >= 2.1:
        eye1.height(face.height() / 6)
        eye2.height(face.height() / 6)
        count = 0
    count += 1

    screen.update()
    screen.sleep(1 / fps)
```

![Example #2 Output](https://i.imgur.com/q15mZZR.gif)

{% hint style="info" %}
Notice how we replaced:

```python
screen.stop()
```

with *this* in order to create an animation loop:

```python
fps = 30
running = True
while running:
    screen.update()
    screen.sleep(1 / fps)
```

{% endhint %}

## Example #3: Input

Now we will move our emoji's mouth based on the mouse's position:

```python
from pydraw import *

screen = Screen(800, 600)
screen.color(Color('gray'))

face = Oval(screen, 100, 0, 600, 600, Color('yellow'))
face.wedges(40)

eye1 = Oval(screen, face.x() + face.width() / 6, 200, face.width() / 7, face.height() / 6)
eye2 = Oval(screen, (face.x() + face.width()) - (face.width() / 6) * 2, 200, face.width() / 7, face.height() / 6)

eyebrow1 = Rectangle(screen, eye1.x() - eye1.width() / 2, 200 - 50, 100, 5, rotation=-16)
eyebrow2 = Rectangle(screen, eye2.x() - 25 + eye2.width() / 2, 200 - 50, 100, 5, rotation=16)

mouth_default = Location(400 - 50, 400)
mouth = Oval(screen, 400 - 50, 400, face.width() / 7, face.height() / 5.5)

def mousemove(location):
    mouth.moveto(mouth_default.x() + (location.x() - mouth_default.x()) / 7,
                    mouth_default.y() + (location.y() - mouth_default.y()) / 7)

screen.listen()

count = 0
fps = 30
running = True
while running:
    seconds = count / fps

    if 1.9 < seconds < 2:
        eye1.height(1)
        eye2.height(1)
    if seconds >= 2.1:
        eye1.height(face.height() / 6)
        eye2.height(face.height() / 6)
        count = 0
    count += 1

    screen.update()
    screen.sleep(1 / fps)
```

![Example #3 Output](https://i.imgur.com/PouDHJe.gif)

{% hint style="info" %}
Notice how a new method was added:

```python
def mousemove(location):
    # code
```

And below that method we tell the screen to listen for input:

```python
screen.listen()
```

{% endhint %}
