WidgetComponent

class widgets.WidgetComponent(background_color: Color = None, corner_radius: float = 0.0, padding: Padding = None, link: str = None)

An abstract class that represents an UI element displayed in a widget.

WidgetComponent attributes can be modified after initialisation, but they can all be set from the initialiser. However, changes made to an WidgetComponent object after being displayed won’t take effect.

background_color

The background color of the element.

Return type:

Color

corner_radius

The radius to use when drawing rounded corners for the view’s background.

Return type:

float

padding

The padding around this component. Use a Padding preset or a custom Padding instance.

See Padding.

Return type:

Union[int, widgets.Padding]

A string that will be passed to the widget script when the element is tapped.

Set this attribute to make the element tappable.

When an element is tapped, the widget is executed in app and the link attribute is passed to link. The element isn’t tappable if this attribute is set to None.

This attribute doesn’t take effect on small widgets.

Return type:

str