# Keybow2040 - send multiple keycodes in response to a single actual keypress?

**URL:** <https://forums.pimoroni.com/t/keybow2040-send-multiple-keycodes-in-response-to-a-single-actual-keypress/17760>\
**Category:** Support\
**Created:** [August 23, 2021, 11:55am UTC](https://forums.pimoroni.com/t/keybow2040-send-multiple-keycodes-in-response-to-a-single-actual-keypress/17760 "2021-08-23T11:55:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmm](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@mmm](https://forums.pimoroni.com/u/mmm)\
**Post date:** [August 23, 2021, 11:55am UTC](https://forums.pimoroni.com/t/keybow2040-send-multiple-keycodes-in-response-to-a-single-actual-keypress/17760/1 "2021-08-23T11:55:25Z")

</div>

Hi all,

Recently got hold of a keybow2040 which I’m having a lot of fun with. What I’d like to do it be able to send multiple keys in response to a single key press (for example I press a single key on the keybow and it sends ALT+F4).

I put this code together -

combo\_1 = [Keycode.ALT,Keycode.F4]  
for k in combo\_1:  
keyboard.send(k)

However that has the the effect of sending the ALT keycode followed by the F4 keycode - not at the same time.

I’ve seen the docs on [GitHub - pimoroni/keybow2040-circuitpython: CircuitPython library for the Pimoroni Keybow 2040](https://github.com/pimoroni/keybow2040-circuitpython) which documents key modifiers but that relates to multiple keypresses on the keybow to send a single keystroke.

Any ideas if its even possible?!

Thanks!

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [August 23, 2021, 12:16pm UTC](https://forums.pimoroni.com/t/keybow2040-send-multiple-keycodes-in-response-to-a-single-actual-keypress/17760/2 "2021-08-23T12:16:47Z")

</div>

Something like this is I think what your after.

```auto
require "keybow"

function handle_key_00(pressed)
    if pressed then
        keybow.set_modifier(keybow.LEFT_META, keybow.KEY_DOWN)
        keybow.tap_key("r", pressed)
        keybow.set_modifier(keybow.LEFT_META, keybow.KEY_UP)
    end
end

```

[https://learn.pimoroni.com/tutorial/sandyj/using-macros-and-snippets-with-keybow](https://learn.pimoroni.com/tutorial/sandyj/using-macros-and-snippets-with-keybow)

---

<div class="post-metadata">

**Author:** ![mmm](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@mmm](https://forums.pimoroni.com/u/mmm)\
**Post date:** [August 23, 2021, 12:19pm UTC](https://forums.pimoroni.com/t/keybow2040-send-multiple-keycodes-in-response-to-a-single-actual-keypress/17760/3 "2021-08-23T12:19:33Z")

</div>

Thanks for the swift response. Thats an example for the keybow hardware and I’m using the keybow2040. I dont believe the code is cross compatible as thats written in lua and I believe the keybow2040 can only use CircuitPython.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [August 23, 2021, 12:59pm UTC](https://forums.pimoroni.com/t/keybow2040-send-multiple-keycodes-in-response-to-a-single-actual-keypress/17760/4 "2021-08-23T12:59:04Z")

</div>

Ah, OK, missed that, ops.

---

<div class="post-metadata">

**Author:** ![mmm](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@mmm](https://forums.pimoroni.com/u/mmm)\
**Post date:** [August 25, 2021, 9:19am UTC](https://forums.pimoroni.com/t/keybow2040-send-multiple-keycodes-in-response-to-a-single-actual-keypress/17760/6 "2021-08-25T09:19:53Z")

</div>

Well I’ve figured it out! Its pretty simple :D

If I want to send ALT and F4 (at the same time) in response to the 10th key on the keyboard being pressed:

```
    if key.number == 9:
        keyboard.send(Keycode.ALT, Keycode.F4)

```

Can’t believe I didnt try that a few days ago!

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [August 25, 2021, 10:08am UTC](https://forums.pimoroni.com/t/keybow2040-send-multiple-keycodes-in-response-to-a-single-actual-keypress/17760/7 "2021-08-25T10:08:30Z")

</div>

That could come in handy for me, thanks for posting the solution. I have the PICO RGB Keypad base, and have it running a port of Keybow 2040 Circuit Python. I have plans for multi key on button press code.

---

<div class="post-metadata">

**Author:** ![euanlowe](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@euanlowe](https://forums.pimoroni.com/u/euanlowe)\
**Post date:** [January 21, 2023, 1:21pm UTC](https://forums.pimoroni.com/t/keybow2040-send-multiple-keycodes-in-response-to-a-single-actual-keypress/17760/8 "2023-01-21T13:21:52Z")

</div>

How would this work inside a layer definition? I have tried the multiple keycodes against a button definition in a layer but i can’t get it to work
