Skip to content

Gui

This module contains the Panel class for creating GUI panels.

CLASS DESCRIPTION
Panel

Panel class for creating GUI panels.

Documentation last updated: 2025-02-22

Panel

Panel(principal: Proxy | Any | None = None)

Panel class for creating GUI panels.

ATTRIBUTE DESCRIPTION
principal

The principal object bound to the Panel.

TYPE: Proxy | Any | None

object_id

The ID of the principal object.

TYPE: str

title

The title of the Panel.

TYPE: str

drawn

A flag indicating if the Panel is drawn.

TYPE: bool

top_level

A flag indicating if the Panel is a top-level window.

TYPE: bool

widget

The tkinter.Tk object bound to the Panel.

TYPE: Tk

sub_panels

A dictionary of sub-panels.

TYPE: dict[str, list[tuple[Panel, dict]]]

stream_update_callbacks

A list of stream update callbacks.

TYPE: list[Callable]

METHOD DESCRIPTION
bindObject

Bind a principal object to the Panel.

releaseObject

Release the principal object from the Panel.

bindWidget

Bind a tkinter.Tk object to the Panel.

releaseWidget

Release the tkinter.Tk object from the Panel.

show

Show the Panel.

close

Close the Panel.

getAttribute

Get an attribute from the principal object.

getAttributes

Get multiple attributes from the principal object.

execute

Execute a method from the principal object.

addPack

Add a Panel to the layout using the pack geometry manager.

addGrid

Add a Panel to the layout using the grid geometry manager.

addPanel

Add a Panel to the layout.

clearPanels

Clear all the Panels from the layout.

updateStream

Update the Panel continuously.

update

Update the Panel values.

refresh

Refresh the Panel layout.

addTo

Add the Panel to a tkinter.Tk or tkinter.Frame object.

Initialize a Panel object.

PARAMETER DESCRIPTION
principal

The principal object to bind to the Panel.

TYPE: Proxy | Any | None DEFAULT: None

addGrid

addGrid(panel: Panel, **kwargs)

Add a Panel to the layout using the grid geometry manager.

PARAMETER DESCRIPTION
panel

The Panel to add.

TYPE: Panel

**kwargs

The keyword arguments to pass to the grid

TYPE: dict DEFAULT: {}

addPack

addPack(panel: Panel, **kwargs)

Add a Panel to the layout using the pack geometry manager.

PARAMETER DESCRIPTION
panel

The Panel to add.

TYPE: Panel

**kwargs

The keyword arguments to pass to the pack geometry manager.

TYPE: dict DEFAULT: {}

addPanel

addPanel(mode: str, panel: Panel, **kwargs)

Add a Panel to the layout.

PARAMETER DESCRIPTION
mode

The geometry manager to use.

TYPE: str

panel

The Panel to add.

TYPE: Panel

**kwargs

The keyword arguments to pass to the geometry manager.

TYPE: dict DEFAULT: {}

addTo

addTo(
    master: Tk | Frame,
    size: Iterable[int, int] | None = None,
) -> tuple[int, int] | None

Add the Panel to a tkinter.Tk or tkinter.Frame object.

PARAMETER DESCRIPTION
master

The tkinter.Tk or tkinter.Frame object to add the Panel to.

TYPE: Tk | Frame

size

The size of the Panel.

TYPE: Iterable[int, int] | None DEFAULT: None

RETURNS DESCRIPTION
tuple[int, int] | None

tuple[int,int]|None: The size of the Panel or None if an error occurred.

bindObject

bindObject(principal: Proxy | Any)

Bind a principal object to the Panel.

PARAMETER DESCRIPTION
principal

The principal object to bind to the Panel.

TYPE: Proxy | Any

bindWidget

bindWidget(widget: Tk)

Bind a tkinter.Tk object to the Panel.

PARAMETER DESCRIPTION
widget

The tkinter.Tk object to bind to the Panel.

TYPE: Tk

clearPanels

clearPanels()

Clear all the Panels from the layout.

close

close()

Close the Panel.

execute

execute(method: Callable, *args, **kwargs) -> Any | None

Execute a method from the principal object.

PARAMETER DESCRIPTION
method

The method to execute.

TYPE: Callable

*args

The positional arguments to pass to the method.

TYPE: tuple DEFAULT: ()

**kwargs

The keyword arguments to pass to the method.

TYPE: dict DEFAULT: {}

RETURNS DESCRIPTION
Any | None

Any|None: The output of the method or None if an error occurred.

getAttribute

getAttribute(
    attribute: str, default: Any | None = None
) -> Any | None

Get an attribute from the principal object.

PARAMETER DESCRIPTION
attribute

The attribute to get.

TYPE: str

default

The default value to return if the attribute is not found.

TYPE: Any | None DEFAULT: None

RETURNS DESCRIPTION
Any | None

Any|None: The value of the attribute or the default value.

getAttributes

getAttributes(
    *attr_defaults: tuple[str, Any],
) -> dict[str, Any]

Get multiple attributes from the principal object.

PARAMETER DESCRIPTION
*attr_defaults

The attributes to get and their default values.

TYPE: tuple[str, Any] DEFAULT: ()

RETURNS DESCRIPTION
dict[str, Any]

dict[str,Any]: A dictionary of the attributes and their values.

refresh

refresh(**kwargs)

Refresh the Panel layout

releaseObject

releaseObject() -> Proxy | Any

Release the principal object from the Panel.

RETURNS DESCRIPTION
Proxy | Any

Proxy|Any: The principal object that was released.

releaseWidget

releaseWidget() -> Tk | None

Release the tkinter.Tk object from the Panel.

RETURNS DESCRIPTION
Tk | None

tk.Tk|None: The tkinter.Tk object that was released.

show

show(title: str = '')

Show the Panel.

PARAMETER DESCRIPTION
title

The title of the Panel.

TYPE: str DEFAULT: ''

update

update(**kwargs)

Update the Panel values

updateStream

updateStream(**kwargs)

Update the Panel continuously