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, OR '.trait_name' if trait_name exists on instance of interactive.
    • 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.2.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.2-py2.py3-none-any.whl (4.6 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: einteract-1.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 d85f4b4bd9623e48ec701202b512cac5134c007693585c15d67342d36d11e2e5
MD5 bd7befdd2ef456d4c4342068dfbc4363
BLAKE2b-256 aa11b4b984ab282a232e4119ef894427204665ddf44d9b6167d43e266559cb01

See more details on using hashes here.

File details

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

File metadata

  • Download URL: einteract-1.2.2-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.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 022438e3367c037e71038cd5e26ae64c44f8b3e153531a61c78fc15a9916b1fb
MD5 c52ba39eef9d0efb8a3350a6c4f694b2
BLAKE2b-256 4340904ed12c6e14c0ef26868229eaee021057cfe6353578882014b8eaa7b5f1

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