Collection of Jupyter Widgets
Project description
wigglystuff
"A collection of expressive Jupyter widgets."
The project uses anywidget under the hood so our tools should work in Jupyter, VSCode and Colab. That also means that you get a proper widget that can interact with ipywidgets natively.
Installation
Installation occurs via pip.
python -m pip install wigglystuff
Usage
Slider2D
from wigglystuff import Slider2D
widget = Slider2D()
widget
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
import ipywidgets
from wigglystuff import Slider2D
widget = 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])
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
wigglystuff-0.1.0.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for wigglystuff-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf3c6d4ae0b5912ade93ccf2a9c339c58af2d1a392158de5bc9e6351c5395ccc |
|
MD5 | 8ef2998a9990f430f590800569b42397 |
|
BLAKE2b-256 | c274b5ed6e784a26fd55e5bcebd178d27582d77d9a72023302aceb5a09e69741 |