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.
    • Add ipywidgets.Button to hold callbacks which use it as paramter for a click
  • 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
import einteract import as ei

@ei.interact(
    ei.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.1.tar.gz (5.4 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.1-py2.py3-none-any.whl (4.6 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: einteract-1.2.1.tar.gz
  • Upload date:
  • Size: 5.4 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.1.tar.gz
Algorithm Hash digest
SHA256 0827ac66f24788372c5142572ec8620681a3c55b5eb6f5849138a7265405e607
MD5 e83e3864072d06d895bf754d24b3da56
BLAKE2b-256 06b6aa7f99251bf1f22659c8cb7c46c7462cb4ee47d3fcec28d0a66b9b153c88

See more details on using hashes here.

File details

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

File metadata

  • Download URL: einteract-1.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.6 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.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 15b1ed6e68be294f505b50065c4b52e90713723f242b88b1297a791453cc3c89
MD5 a1a0ed78a0e11f0fdf9d91fba2be88f2
BLAKE2b-256 43381f2a782aa6bfb7d25b4e444bd3bd24e329bd4b22e8eed38b1c5e3083cbef

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