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.
    • You can use '.fullscreen' to detect fullscreen change and do actions based on that.
    • 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 Examples

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.3.tar.gz (5.5 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.3-py2.py3-none-any.whl (4.7 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: einteract-1.2.3.tar.gz
  • Upload date:
  • Size: 5.5 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.3.tar.gz
Algorithm Hash digest
SHA256 3478aa320972547082ae093dccb788d8a315215e07857cdac7de1d1e224da4ea
MD5 5357b2f6448af45481b4b3b3788fd524
BLAKE2b-256 a1435fac82c237668ef68992d0b373f591cecd027c7c7eb0c4f827897ed12617

See more details on using hashes here.

File details

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

File metadata

  • Download URL: einteract-1.2.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.7 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.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ff568f9542adbc3df70af7018a1e5fa3dab4c73403f032983f8e3b18bcab0b5c
MD5 5d4dcb26dfb8db43315b707c56635548
BLAKE2b-256 73cb5a50d2c10243cb9896c137f7c6ad08e3972ef7b9008f8bb8e9cac073b097

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