Widget (hwx.gui)#

class Widget#

Bases: object

Abstract base class for all widgets.

Attribute Table#

Name

Type

active

property

advancedTooltip

property

children

property

command

property

descendents

property

enabled

property

font

property

height

property

helpTopic

property

layout

property

maximumHeight

property

maximumWidth

property

minimumHeight

property

minimumWidth

property

name

property

onHide

Signal

onKeyPress

Signal

onKeyRelease

Signal

onMouseEnter

Signal

onMouseLeave

Signal

onMousePress

Signal

onMouseRelease

Signal

onResize

Signal

onShow

Signal

parent

property

size

property

tooltip

property

value

property

visible

property

width

property

Method Table#

Name

Description

addChildren (self, children)

Add child widgets/layouts into this widget.

destroy (self)

Deletes this and all its children.

enableGlobalActions (self, enable)

Sets the state of Global Actions.

getMousePosition (self)

Returns the mouse position.

getRelativeMousePosition (self)

Returns the mouse position relative to this widget.

hide (self)

Hides the widget.

saveAsPng (self, fname)

Saves the widget as a .png file.

setF1HelpTopic (self, helptopic)

Popup web-browser helps when the user hits F1 when over this.

setProperties (self, kwds)

Internal method called from constructors.

show (self)

Shows the widget.

addChildren(children)#

Add child widgets/layouts into this widget.

Widget children get layed out using a VBoxLayout.

Typically, you’ll pass the parent/children into the constructor instead of calling this function directly.

Parameters:

children (list[Widget] | Layout) –

destroy()#

Deletes this and all its children.

property value#

The value of the widget.

property command#

Method called when the widget is activated or changed.

property name#

The unique identifier within a container.

property parent#

The container that owns this widget.

property children#

All widgets immediately contained by this one.

property descendents#

All the widgets ultimately contained by this one.

property layout#

The layout that contains this widget’s children.

property size#

The fixed size of the widget (width, height).

property width#

The fixed width of the widget.

If a string or list of strings are specified, the width will be calculated from the longest string given the font.

property height#

Fixed height of the widget.

property minimumWidth#

The smallest allowable width inside the Layout.

property maximumWidth#

The maximum allowable width inside the Layout.

property minimumHeight#

The smallest allowable height inside the Layout.

property maximumHeight#

The maximum allowable height inside the Layout.

property font#

The font used in this widget (set with font or dict).

property visible#

The visibility of the widget.

property enabled#

The availability of the widget.

Disabled widgets are greyed out and don’t respond to input events.

property active#

Returns True if it is visible and enabled, False otherwise. (readonly property)

property tooltip#

The tooltip that appears while hovering mouse over widget.

property advancedTooltip#

The advanced tooltip that appears while hovering mouse over widget.

show()#

Shows the widget.

hide()#

Hides the widget.

getMousePosition()#

Returns the mouse position.

getRelativeMousePosition()#

Returns the mouse position relative to this widget.

setF1HelpTopic(helptopic)#

Popup web-browser helps when the user hits F1 when over this.

Parameters:

helptopic (str) – Topic name user needs help in.

property helpTopic#

Popup web-browser helps when the user hits F1 when over this.

Parameters:

helptopic (str) – Topic name user needs help in.

enableGlobalActions(enable)#

Sets the state of Global Actions.

Disable the global actions to get key events.

Parameters:

enable (bool) – Determines whether to enable or disable global actions.

saveAsPng(fname)#

Saves the widget as a .png file.

Parameters:

fname (str) – The file name for the .png

Returns:

True if it was saved succesfully, False otherwise.

Return type:

bool

setProperties(kwds)#

Internal method called from constructors.