An enhanced version of ipywidgets's interactive widgets.
Project description
einteract
An enhanced interactive widget that lets you observe any trait of widgets, observe multiple functions and build beautiful dashboards which can be turned into full screen. This is a wrapper library around interact functionality in ipyslides which also provides rich content representations.
See code of this simple yet fully customizable dashboard on binder
Installation
You can install einteract using pip:
pip install einteract
Or if you prefer to install from source, clone the repository and in its top folder, run:
pip install -e .
Features
- InteractBase: Create interactive dashboard applications with minimal code by extending the
InteractBaseclass and defining methods with the@callbackdecorator. - Custom Widgets:
- Included custom built widgets for enhanced interaction.
- Pass any DOMWidget as a parameter to
interact/interactivefunctions unlike defaultipywidgets.interactivebehavior. - Observe any trait of the widget by
{'widget_name': 'trait_name'}where'widget_name'is assigned to awidget/fixed(widget)in control parameters.
- Plotly Integration: Modified plotly support with additional traits like
selectedandclicked - Matplotlib Support: Convert matplotlib plots to HTML format using
plt2html - Event Callbacks: Easy widget event handling with the
@callbackdecorator inside the subclass ofInteractBaseor multiple functions ininteract/interactivefunctions. - Full Screen Mode: Transform your dashboards into full-screen applications by added button.
Quick Start
import numpy as np
import matplotlib.pyplot as plt
import ipywidgets as ipw
from einteract import interact, classed
@interact(
classed(lambda smax: print(f"Maximum amplitude: {smax}"), 'out-smax'),
slider = ipw.fixed(ipw.IntSlider(min=1,max=10)),
frequency = (0.1, 20.0,5),
smax = {'slider': 'max'},
amp = {'slider': 'value'},
app_layout = {'left_sidebar': ['slider','frequency', 'out-smax'], 'center':['out-0']}
)
def plot_sine(amp=1.0, frequency=5.0):
plt.figure(figsize=(8, 4))
X = np.linspace(0,10,100)
plt.plot(X, amp * np.sin(frequency*X)) # amplited is passed as slider
plt.grid(True)
plt.show()
Comprehensive Example
For a more comprehensive example, check out the einteract-demo.ipynb which demonstates subclassing InteractBase, using custom widgets, and observing multiple functions through the @callback decorator.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file einteract-1.1.0.tar.gz.
File metadata
- Download URL: einteract-1.1.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e187aaef2b7d32bff28ba52dcf1fcf0cfba5d9a8285f36edf9f868c297fb275a
|
|
| MD5 |
d08105ea1768889297d19b6d4bf83df1
|
|
| BLAKE2b-256 |
389e8a6c2a91d0a8c6d76efbd2ce836cb7dca91b6b190785b181988d74b41af0
|
File details
Details for the file einteract-1.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: einteract-1.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd06090520c7e15a4afee21681317751280da85635d21eef56b96ea5d15a9241
|
|
| MD5 |
63c5bca0b2d14e4d75b94cbf394d14dc
|
|
| BLAKE2b-256 |
7a8af0c43adbc1d0125f491a7701a49a72e2ad358a54ca47c5c5b1995498aadc
|