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

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: einteract-1.2.4.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.4.tar.gz
Algorithm Hash digest
SHA256 3725f8135594b9e523c829295f1f48503cd3ed63b1dc9794d8318646c6ee1ef3
MD5 c77885e8448fab1c3b50b4dca9661d14
BLAKE2b-256 5652d0b1435fe445e75291d35bcc15d201ec01b43d27915f42f9db6c3a04e7ca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: einteract-1.2.4-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.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4394c60e0559e08acd92f0f743ea3323a4ebb167a9ac734367d84558cd17fae3
MD5 5d614ed7a3b0948cb7a79bb3565ba412
BLAKE2b-256 8e0982ab98f97f75b345f7c094840be7db87cc51ba92f576270b3e024363e110

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