Skip to main content

An enhanced version of ipywidgets's interactive widgets.

Project description

einteract

Binder PyPI version Downloads

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 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 InteractBase class and defining methods with the @callback decorator.
  • Custom Widgets:
    • Included custom built widgets for enhanced interaction.
    • Pass any DOMWidget as a parameter to interact/interactive functions unlike default ipywidgets.interactive behavior.
    • Observe any trait of the widget by {'widget_name': 'trait_name'} where 'widget_name' is assigned to a widget/fixed(widget) in control parameters.
  • Plotly Integration: Modified plotly support with additional traits like selected and clicked
  • Matplotlib Support: Convert matplotlib plots to HTML format using plt2html
  • Event Callbacks: Easy widget event handling with the @callback decorator inside the subclass of InteractBase or multiple functions in interact/interactive functions.
  • 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()

simple example

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

einteract-1.2.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

einteract-1.2.0-py2.py3-none-any.whl (4.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file einteract-1.2.0.tar.gz.

File metadata

  • Download URL: einteract-1.2.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

Hashes for einteract-1.2.0.tar.gz
Algorithm Hash digest
SHA256 c70a6332d88901a718ec3be3bc8cf54597dfddf469b5d2a23d17ab4d9c44a561
MD5 d6d89c5a139e31b084f66e0616ea9a11
BLAKE2b-256 44b017216bb4684fa2a0da28112052fa584eec43b853344fcfcd626e86a43bb7

See more details on using hashes here.

File details

Details for the file einteract-1.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: einteract-1.2.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

Hashes for einteract-1.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6dba99f3e51162382d6bd947df0a0679a1c679f8b79df65cdb11ca3a997ad1fc
MD5 fac397e9ff959c275f2cd91ed0483e15
BLAKE2b-256 520a5a339c0866bfdf62dd35728c61efd244f0efa9c29a9e11a7472856ce6370

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page