euporie.core.comm.ipympl

This module contains ipympl Comm implementations.

Classes

Box(body[, padding, padding_left, ...])

Add padding around a container.

Button(text, width, align, ...)

A clickable button widget which holds text.

CommView(container[, setters])

Hold a container and methods to update its attributes.

Condition(func)

Turn any callable into a Filter.

ConditionalContainer(content, filter[, ...])

Wrapper around any other container that can change the visibility.

Datum(data, *args, **kwargs)

Class for storing and converting display data.

Display(datum[, height, width, focusable, ...])

Rich output displays.

FocusedStyle(body[, style_focus, style_hover])

Apply a style to child containers when focused or hovered.

HSplit(children[, window_too_small, align, ...])

Several layouts, one stacked above/under the other.

IpyWidgetComm(comm_container, comm_id, data, ...)

A Comm object which represents ipython widgets.

Label(value[, style, html, ...])

A label widget which displays rich text.

MPLCanvasModel(comm_container, comm_id, ...)

A ipywidget which displays an image.

MouseButton(*values)

MouseEventType(*values)

MouseModifier(*values)

RelativePosition(x, y)

Store the relative position or the mouse within a terminal cell.

ToggleButton(text, on_click, ...)

A toggleable button widget.

ToolbarModel(comm_container, comm_id, data, ...)

A toolbar with a list of buttons.

VSplit(children[, window_too_small, align, ...])

Several layouts, one stacked left/right of the other.

partial(func, /, *args, **keywords)

Create a new function with partial application of the given arguments and keywords.

class euporie.core.comm.ipympl.MPLCanvasModel(comm_container: KernelTab, comm_id: str, data: dict, buffers: Sequence[bytes])

Bases: IpyWidgetComm

A ipywidget which displays an image.

create_view(parent: OutputParent) CommView

Create a new view of the image widget.

mouse_handler(mouse_event: PtkMouseEvent) NotImplementedOrNone

Process a mouse event, and forward it to the kernel.

Parameters:

mouse_event – The prompt-toolkit mouse event to process.

new_view(parent: OutputParent) CommView

Create and register a new CommView for this Comm.

process_data(data: dict, buffers: Sequence[memoryview | bytearray | bytes]) None

Process data received from the kernel.

Parameters:
  • data – The data dictionary from the comm message.

  • buffers – The binary buffers from the comm message.

set_data(display: Display, value: bytes) None

Set the image data for a display from bytes.

Parameters:
  • display – The display to update.

  • value – The new image data.

set_size(display: Display, value: list[float]) None

Set the size of the canvas display.

Parameters:
  • display – The display to resize.

  • value – The new [width, height] of the canvas.

set_state(key: str, value: JSONType) None

Send a comm_msg to the kernel with local state changes.

set_url(display: Display, data_uri: str) None

Set the image data for a display from a data URI.

Parameters:
  • display – The display to update.

  • data_uri – The data URI of the new image.

target_name = 'jupyter.widget'
update_views(changes: dict) None

Update all the active views of this Comm.

class euporie.core.comm.ipympl.ToolbarModel(comm_container: KernelTab, comm_id: str, data: dict, buffers: Sequence[memoryview | bytearray | bytes])

Bases: IpyWidgetComm

A toolbar with a list of buttons.

click(method: str, button: Button) None

Send a comm_msg describing a click event.

create_view(parent: OutputParent) CommView

Create a new view of the toolbar ipywidget.

new_view(parent: OutputParent) CommView

Create and register a new CommView for this Comm.

process_data(data: dict, buffers: Sequence[memoryview | bytearray | bytes]) None

Handle incoming Comm update messages, updating the state and views.

set_state(key: str, value: JSONType) None

Send a comm_msg to the kernel with local state changes.

target_name = 'jupyter.widget'
update_views(changes: dict) None

Update all the active views of this Comm.