SpacerItem (hwx.gui)#

class SpacerItem(width, height, spacing='horizontal', **kwds)#

Bases: Widget

A Widget that adds a horizontal and vertical spacer.

Method Table#

Name

Description

isEmpty (self)

Checks if the spacer item is empty.

resize (self, width, height, spacing=’horizontal’)

Resize the spacer item is empty.

Example

from hwx import gui

# --------------------------------------------------------------------------

# Creating SpacerItem.
spacerItem = gui.SpacerItem(217, 20)

text = gui.TextEdit(
parent=None,
name='TextEdit',
)

button1 = gui.PushButton(
parent=None,
name='uiPushButton',
text='OK',
)

button2 = gui.PushButton(
parent=None,
name='uiPushButton_2',
text='Cancel',
)

# layouts
gridLayout = gui.GridLayout(
spacing=6,
children=(
   (text, '-', '-',),
   (spacerItem, button1, button2,),
)
)
gridLayout.SetColStretch(0, 100)

dialog = gui.Dialog(caption="SpacerItem", children=(gridLayout,), height=145, width=700)

show(dialog)
isEmpty()#

Checks if the spacer item is empty.

resize(width, height, spacing='horizontal')#

Resize the spacer item is empty.

Parameters:
  • width (float) – Resize width of the spacer item.

  • height (float) – Resize height of the spacer item.

  • spacing (str) – It can be either ‘horizontal’ or ‘vertical’.