# I need a little help on python

**URL:** https://discourse.processing.org/t/i-need-a-little-help-on-python/25118
**Category:** Processing.py
**Created:** [November 1, 2020, 3:39pm UTC](https://discourse.processing.org/t/i-need-a-little-help-on-python/25118 "2020-11-01T15:39:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Lorenzo](https://avatars.discourse-cdn.com/v4/letter/l/4da419/32.png) [@Lorenzo](https://discourse.processing.org/u/Lorenzo)
#### Post date: [November 1, 2020, 3:39pm UTC](https://discourse.processing.org/t/i-need-a-little-help-on-python/25118/1 "2020-11-01T15:39:14Z")

</div>

Hello I’m looking for how to use the enter key instead of the e key in this program.

> if keyPressed == True:
> 
> > if key==“e”:
> > 
> > > ent=1

Thank you in advance for your reply

---

<div class="post-metadata">

### Author: ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)
#### Post date: [November 1, 2020, 5:37pm UTC](https://discourse.processing.org/t/i-need-a-little-help-on-python/25118/2 "2020-11-01T17:37:29Z")

</div>

Welcome to the forum @Lorenzo! 😀

For some keys you have to check the special constants against `keyCode` instead of `key` (SHIFT or LEFT / RIGHT / UP / DOWN arrows) but this is not the case for ENTER or RETURN (it varies depending on your keyboard layout and platfform)

```auto
rect_fill = color(126)

def draw():
    fill(rect_fill)
    rect(25, 25, 50, 50)

def keyPressed():
    global rect_fill
    if key == ENTER:
        rect_fill = 0
    elif key == RETURN:
        rect_fill = 255
    else:
        rect_fill = 126

```

Next time, check out the “preformatted text” option when composing messages (````` ) so you can post better formatted code 🙂

---

<div class="post-metadata">

### Author: ![Lorenzo](https://avatars.discourse-cdn.com/v4/letter/l/4da419/32.png) [@Lorenzo](https://discourse.processing.org/u/Lorenzo)
#### Post date: [November 1, 2020, 6:01pm UTC](https://discourse.processing.org/t/i-need-a-little-help-on-python/25118/3 "2020-11-01T18:01:02Z")

</div>

Thank you very much you can’t imagine what a bridge I am happy to have had a response so quickly! thank you 😁
