Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koaning/wigglystuff
Creative widgets for Jupyter
https://github.com/koaning/wigglystuff
Last synced: about 1 month ago
JSON representation
Creative widgets for Jupyter
- Host: GitHub
- URL: https://github.com/koaning/wigglystuff
- Owner: koaning
- License: mit
- Created: 2024-05-19T19:19:03.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-10-23T20:50:20.000Z (about 2 months ago)
- Last Synced: 2024-10-24T08:42:10.156Z (about 2 months ago)
- Language: Python
- Size: 200 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-marimo - wigglystuff
README
# wigglystuff
> "A collection of expressive Jupyter widgets."
The project uses [anywidget](https://anywidget.dev/) under the hood so our tools should work in Jupyter, VSCode, Colab *and* [Marimo](https://marimo.io/). That also means that you get a proper widget that can interact with [ipywidgets](https://ipywidgets.readthedocs.io/en/stable/) natively.
## Installation
Installation occurs via pip.
```
python -m pip install wigglystuff
```## Usage
### `Slider2D`
```python
from wigglystuff import Slider2Dwidget = Slider2D()
widget
```![](imgs/slider2d.gif)
This widget allows you to grab the `widget.x` and `widget.y` properties to get the current position of the slider. But you can also use the `widget.observe` method to listen to changes in the widget.
Example of
widget.observe
```python
import ipywidgets
from wigglystuff import Slider2Dwidget = Slider2D()
output = ipywidgets.Output()
state = [[0.0, 0.0]]@output.capture(clear_output=True)
def on_change(change):
if abs(widget.x - state[-1][0]) > 0.01:
if abs(widget.y - state[-1][1]) > 0.01:
state.append([widget.x, widget.y])
for elem in state[-5:]:
print(elem)widget.observe(on_change)
on_change(None)
ipywidgets.HBox([widget, output])
```### `Matrix`
```python
from wigglystuff import Matrixarr = Matrix(rows=1, cols=2, step=0.1)
mat = Matrix(matrix=np.eye(2), triangular=True, step=0.1)
```![](imgs/matix.gif)