Streamlit keyboard shortcuts for your buttons.
Project description
Streamlit Shortcuts
Streamlit Shortcuts allows you to easily add keyboard shortcuts to your Streamlit buttons.
Installation
pip install streamlit-shortcuts
Example
import streamlit as st
from streamlit_shortcuts import add_keyboard_shortcuts
def delete_callback():
st.write("DELETED!")
st.button("delete", on_click=delete_callback)
add_keyboard_shortcuts({
'Ctrl+Shift+X': 'delete',
# Add more key-button mappings here
})
The 'Ctrl+Shift+X' combination will trigger "Another Button".
Keys
- Modifiers: 'Control', 'Shift', 'Alt'
- Common Keys: 'Enter', 'Escape', 'Space'
- Arrow Keys: 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'
Examples of Key Combinations:
- 'Control+Enter'
- 'Shift+ArrowUp'
- 'Alt+Space'
For a complete list of key values, refer to: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
Contributing
Contributions are welcome! If you have suggestions for improvements or bug fixes, please feel free to make a pull request or open an issue.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for streamlit-shortcuts-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0eb0dee1956d2577c5052bc1ed83eab20732f4f2de16ee662575bc0c7a471929 |
|
MD5 | 3d041be836ce5a599e6a3adb595cbf16 |
|
BLAKE2b-256 | ae60b9957bb2d1dacf65fcc7263b21c3b2acf92a8a37a9c0bccfe487ddf73092 |
Close
Hashes for streamlit_shortcuts-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e4127235b903ff34913651949cf3c88ec7fb3db95840b2ac6f474f99eb57312 |
|
MD5 | 82f5bc98fdd0e7adce48a658188d4181 |
|
BLAKE2b-256 | 70d576f2835d8a5e35ad12c61a05f61026358a82bbe96cf14c06fd6192bcda5e |