Skip to content

Commit

Permalink
docs: reword
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangalilea committed Sep 2, 2024
1 parent 4f92df5 commit b3e3221
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

Streamlit Shortcuts allows you to easily add keyboard shortcuts to your Streamlit buttons.


![screenshot](media/screenshot.png)

⭐ New in v0.1.9
- More robust logic.
- Simplified usage.
- Bug fixes.
- New [`example.py`](./example.py) for easy testing after pulling (change import path if installed)

![screenshot](media/screenshot.png)
- New [`example.py`](./example.py).

## Installation

Expand All @@ -30,10 +31,6 @@ def greet(name):

button("Greet", "ctrl+shift+g", greet, hint=True, args=("World",))

# Using a lambda
if button("Click me!", "ctrl+shift+c", lambda: st.success("Button clicked!"), hint=True):
st.write("Button was clicked")

```

To run the example, clone the repository and execute:
Expand All @@ -44,6 +41,13 @@ streamlit run example.py

This will launch a Streamlit app demonstrating various ways to use streamlit-shortcuts.

Extra: define shortcut function with a lambda:

```python
if button("Click me!", "ctrl+shift+c", lambda: st.success("Button clicked!"), hint=True):
st.write("Button was clicked")
```

## Keys
- Modifiers: 'Ctrl', 'Shift', 'Alt', 'Meta' ('Cmd' on Mac or 'Win' on Windows, thanks to @toolittlecakes)
- Common Keys: 'Enter', 'Escape', 'Space'
Expand Down

0 comments on commit b3e3221

Please sign in to comment.