> For the complete documentation index, see [llms.txt](https://learnpython.strivemath.com/p5-python-web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learnpython.strivemath.com/p5-python-web/reference/events/mouse/keyboard-1.md).

# mouseDragged()

## Example

<figure><img src="/files/UeanFhkHef6Yammk5aWW" alt=""><figcaption><p>Pointer has a yellow circle</p></figcaption></figure>

## Syntax

```
def mouseDragged():
    # do stuff
```

<details>

<summary>Full Code Example</summary>

```python
def setup():
  createCanvas(300,300)

show = False

def draw():
  global show
  background(255, 79, 132)
  fill(255, 164, 28)
  stroke(44, 129, 237)
  strokeWeight(10)

  if show:
    circle(150, 150, 150)
  show = False

def mouseDragged():
  global show
  show = True
```

</details>

## Description

This function is called every time the **mouse moves** and **some** mouse button is pressed.

{% hint style="info" %}
Find these documents helpful? Let the people who made them help your child learn to code at [**Strivemath**](https://www.strivemath.com/)<mark style="color:blue;">**!**</mark>

We'd love to hear your Feedback/Comments [here](https://docs.google.com/forms/d/e/1FAIpQLSeqorBAGTya-YBRI-VFjJxtgQtCz3ucGDI96K96sNyuaGuvdw/viewform?usp=sf_link).
{% endhint %}
