microGUI.Widgets.Widget

Classes

Widget

Widget is the fundamental superclass. All widgets belong to a subclass of Widget.

Module Contents

class microGUI.Widgets.Widget.Widget(*args, **kwargs)

Widget is the fundamental superclass. All widgets belong to a subclass of Widget.

See also

dynamic_widget_caste()

property AllowDrop
Gets or sets a value indicating whether the widget can accept data that the user drags onto it.

See also

  • DragEventArgs

  • DragOver

  • DragDrop

  • DragEnter

  • DragLeave

  • DoDragDrop

Getter:

Return true if drag-and-drop operations are allowed in the widget; otherwise, false. The default is false.

Setter:

Sets AllowDrop property

Raises:

TypeError – When not set AllowDrop with a bool type or None

Type:

bool

property Anchor
Gets or sets a value indicating whether the widget can accept data that the user drags onto it.

Exemple

widget = Widget()
widget.Anchor = ( Widgets.AnchorStyles.Bottom | Widgets.AnchorStyles.Right )

Attention

Use the Widget.Anchor property to define how a widget is automatically resized as its parent widget is resized. Anchoring a widget to its parent widget ensures that the anchored edges remain in the same position relative to the edges of the parent widget when the parent widget is resized. You can anchor a widget to one or more edges of its container. For example, if you have a Container with a Button whose microGUI.Widgets.Button.Anchor property value is set to microGUI.Widgets.AnchorStyles.Top and microGUI.Widgets.AnchorStyles.Bottom, the microGUI.Widgets.Button is stretched to maintain the anchored distance to the top and bottom edges of the Container as the Height of the Container is increased.

See also

getter:

Return True if drag-and-drop operations are allowed in the widget; otherwise, False. The default is False.

setter:

Sets Anchor property

raise TypeError:

When not set AllowDrop with a bool type or None

type:

A bitwise combination of the Flags microGUI.Widgets.AnchorStyles values.

property BevelWidth: int

Gets or sets the bevel width of the widget.

Attention

The width of the widget’s bevel if the widget is highlighted and is to draw a bevel.

See also

  • microGUI.Widgets.Widget.ThisFlagsHighlighted

  • microGUI.Widgets.Basic.ThisFlags.Basic

Getter:

The bevel width of the widget in chars.

Setter:

Sets BevelWidth property

Raises:

TypeError – When BevelWidth property value is not set with an int or None

Type:

int

property Bottom: int

Gets the distance, in chars, between the bottom edge of the widget and the top edge of its container’s client area.

Attention

The value of this property is equal to the sum of the Top property value, and the Height property value.

The Bottom property is a read-only property. You can manipulate this property value by changing the value of the Top or Height properties or calling the SetBounds() methods.

See also

  • microGUI.Widgets.Widget.Top

  • microGUI.Widgets.Widget.Height

Getter:

An int representing the distance, in chars, between the bottom edge of the widget and the top edge of its container’s client area.

Type:

int

property Bounds: microGUI.Types.Area.AreaType

Gets or sets the size and location of the widget including its nonclient elements, in pixels, relative to the parent widget.

Examples:

# Create the widget
widget = Widget()

# Set value directly from the widget default Bounds property
widget.Bounds.pos = PointType(20, 48)
widget.Bounds.size = DimType(12, 20)
# Create the widget
widget = Widget()

# Replace the default Bounds object by a AreaType class
widget.Bounds = AreaType(
    PointType(20, 48),
    DimType(12, 20),
)

See also

  • Top

  • Left

  • Left

  • Width

Setter:

Set a AreaType in pixels/chars relative to the parent widget that represents the size and location of the widget including its nonclient elements.

Getter:

Return Bounds property

Return type:

AreaType

Raises:

TypeError – When Bounds property value is not set with an AreaType instance or None

property CanFocus: bool

Gets a value indicating whether the widget can receive focus.

Attention

In order for a widget to receive input focus, the microGUI.Widgets.Widget.widget must be assigned, and the Visible and Enabled properties must both be set to True for both the widget and all its parent widgets, and the widget must be a microGUI.Widgets.Window.Window or the widget’s outermost parent must be a microGUI.Widgets.Window.Window.

See also

  • Enabled

  • Visible

  • Focus()

  • Focused

  • CanSelect

Getter:

True if the widget can receive focus; otherwise, False.

Return type:

bool

property CanSelect
get()

Returns the stored pointer.

Returns:

self from widget point of view

Return type:

Widget