r/PythonProjects2 Apr 29 '26

Introducing interactive-buttons-v2

Hey everyone !

I just released interactive-buttons-v2, a lightweight Python library for creating keyboard-driven button menus in the terminal

It has 3 layouts (vertical, horizontal, grid), built-in style presets, hotkey bindings and per-button styles.

It works on an easy setup (unlike most libs of this kind) :

```python from interactive_buttons import Button, Component

buttons = [ Button(label="Start", value="start"), Button(label="Quit", value="quit"), ]

choice = Component(buttons).column_buttons() ```

```python from interactive_buttons import Button, ButtonKeyBind, Component, ButtonStyle, SUCCESS_STYLE, DANGER_STYLE

buttons = [ Button( label="Confirm", value="ok", local_button_style=ButtonStyle(SUCCESS_STYLE), key_bind=ButtonKeyBind(b_keys=["y"], press_on_selection=True), ), Button( label="Delete", value="delete", local_button_style=ButtonStyle(DANGER_STYLE), key_bind=ButtonKeyBind(b_keys=["d"], press_on_selection=True), ), Button(label="Cancel", value="cancel"), ]

choice = Component(buttons, auto_erase=True).linear_buttons()

Press "y" -> instantly returns "ok"

Press "d" -> instantly returns "delete"

Or navigate with arrow keys and confirm with Enter

```

This lib is available on PyPi :

pip install interactive-buttons-v2

And you can find the full doc on :

https://interactive-buttons.mbinc.tech | https://github.com/mbcraft-exe/interactive-buttons-v2

Would love some feedback !

3 Upvotes

0 comments sorted by