Layouts#

Layout Class#

class Layout(*args: Any, **kwargs: Any)#

Base class for BoxLayout and GridLayout.

class ResizeMode(*args: Any, **kwargs: Any)#

FreeResize: The widget is not constrained. Minimum: size > minimumSize Maximum: size < maximumSize MinAndMaxSize: minimumSize < size < maximumSize Fixed: Fixed at SizeHint() and cannot be resized. Auto: size > minimumSize

setProperties(kwds)#

Internal method called from constructors.

property border#

The spacing around the sides.

property margin#

The spacing around the sides.

property resizeMode#

The widget is not constrained. Minimum: size > minimumSize Maximum: size < maximumSize MinAndMaxSize: minimumSize < size < maximumSize Fixed: Fixed at SizeHint() and cannot be resized. Auto: size > minimumSize

Type:

FreeResize

property spacing#

The spacing between widgets.

BoxLayout Class#

class BoxLayout(*args: Any, **kwargs: Any)#

Base class for HBoxLayout and VBoxLayout.

class ResizeMode(*args: Any, **kwargs: Any)#

FreeResize: The widget is not constrained. Minimum: size > minimumSize Maximum: size < maximumSize MinAndMaxSize: minimumSize < size < maximumSize Fixed: Fixed at SizeHint() and cannot be resized. Auto: size > minimumSize

addChildren(children)#

Adds the specified children in the BoxLayout.

Parameters:

children (list[Widget]) – The items to be added.

setProperties(kwds)#

Internal method called from constructors.

property border#

The spacing around the sides.

property margin#

The spacing around the sides.

property resizeMode#

The widget is not constrained. Minimum: size > minimumSize Maximum: size < maximumSize MinAndMaxSize: minimumSize < size < maximumSize Fixed: Fixed at SizeHint() and cannot be resized. Auto: size > minimumSize

Type:

FreeResize

property spacing#

The spacing between widgets.

HBoxLayout Class#

class HBoxLayout(*args: Any, **kwargs: Any)#

Layout widgets horizontally.

Example of a HBoxLayout#
from hwx import gui

# Layout with three buttons horizontally with 3 pixels of spacing between buttons
# and 5 pixels of border around the layout.

layout = gui.HBoxLayout(
   border   = 5,
   spacing  = 3,
   children = (
      "Button A", gui.Button('A'),
      "Button B", gui.Button('B'),
      "Button C", gui.Button('C'),
   ),
)

show(layout)
class ResizeMode(*args: Any, **kwargs: Any)#

FreeResize: The widget is not constrained. Minimum: size > minimumSize Maximum: size < maximumSize MinAndMaxSize: minimumSize < size < maximumSize Fixed: Fixed at SizeHint() and cannot be resized. Auto: size > minimumSize

addChildren(children)#

Adds the specified children in the BoxLayout.

Parameters:

children (list[Widget]) – The items to be added.

setProperties(kwds)#

Internal method called from constructors.

property border#

The spacing around the sides.

property margin#

The spacing around the sides.

property resizeMode#

The widget is not constrained. Minimum: size > minimumSize Maximum: size < maximumSize MinAndMaxSize: minimumSize < size < maximumSize Fixed: Fixed at SizeHint() and cannot be resized. Auto: size > minimumSize

Type:

FreeResize

property spacing#

The spacing between widgets.

VBoxLayout Class#

class VBoxLayout(*args: Any, **kwargs: Any)#

Layout widgets vertically.

Example of a VBoxLayout#
from hwx import gui

# Layout with two buttons vertically with 3 pixels of spacing between buttons
# and 5 pixels of border around the layout.

layout = gui.VBoxLayout(
   border   = 5,
   spacing  = 2,
   children = (
      gui.Button('A'),
      gui.Button('B'),
   ),
)

show(layout)
class ResizeMode(*args: Any, **kwargs: Any)#

FreeResize: The widget is not constrained. Minimum: size > minimumSize Maximum: size < maximumSize MinAndMaxSize: minimumSize < size < maximumSize Fixed: Fixed at SizeHint() and cannot be resized. Auto: size > minimumSize

addChildren(children)#

Adds the specified children in the BoxLayout.

Parameters:

children (list[Widget]) – The items to be added.

setProperties(kwds)#

Internal method called from constructors.

property border#

The spacing around the sides.

property margin#

The spacing around the sides.

property resizeMode#

The widget is not constrained. Minimum: size > minimumSize Maximum: size < maximumSize MinAndMaxSize: minimumSize < size < maximumSize Fixed: Fixed at SizeHint() and cannot be resized. Auto: size > minimumSize

Type:

FreeResize

property spacing#

The spacing between widgets.

GridLayout Class#

class GridLayout(*args: Any, **kwargs: Any)#

Layout widgets in rows and columns.

Example of a GridLayout#
from hwx import gui

displacement = gui.DoubleEdit(9.8, units="length")
velocity     = gui.DoubleEdit(3.2, units="velocity")

layout = gui.GridLayout(
   border   = 5,
   spacing  = (5,2),
   children = (
      ("Displacement", displacement),
      ("Velocity",     velocity),
   ),
)

show(layout)
class ResizeMode(*args: Any, **kwargs: Any)#

FreeResize: The widget is not constrained. Minimum: size > minimumSize Maximum: size < maximumSize MinAndMaxSize: minimumSize < size < maximumSize Fixed: Fixed at SizeHint() and cannot be resized. Auto: size > minimumSize

addChildren(children, nrows=None, ncols=None)#

Add the children in the grid layout.

Parameters:
  • children (list[Widget]) – The items to be added in the layout.

  • nrows (int) – The number of rows in the grid.

  • ncols (int) – The number of columns in the grid.

setProperties(kwds)#

Internal method called from constructors.

property border#

The spacing around the sides.

property margin#

The spacing around the sides.

property resizeMode#

The widget is not constrained. Minimum: size > minimumSize Maximum: size < maximumSize MinAndMaxSize: minimumSize < size < maximumSize Fixed: Fixed at SizeHint() and cannot be resized. Auto: size > minimumSize

Type:

FreeResize

property spacing#

The spacing between widgets.

ExpanderLayout Class#

class ExpanderLayout(*args: Any, **kwargs: Any)#

Gridlayout that also manages expanding and collapsing the area containing the widgets that follow and ExpanderButton.

Example of a ExpanderLayout#
from hwx import gui

displacement = gui.DoubleEdit(9.8, units="length")
velocity     = gui.DoubleEdit(3.2, units="velocity")
expander     = gui.ExpanderButton()

# "-" symbol inside a ExpanderLayout children denotes a previous column
# stretch in a row.
layout = gui.ExpanderLayout(
   border   = 5,
   spacing  = (5,2),
   children = (
      ("Displacement", displacement, expander),
      ("Velocity", velocity, "-"),
   ),
)

show (layout)
class ResizeMode(*args: Any, **kwargs: Any)#

FreeResize: The widget is not constrained. Minimum: size > minimumSize Maximum: size < maximumSize MinAndMaxSize: minimumSize < size < maximumSize Fixed: Fixed at SizeHint() and cannot be resized. Auto: size > minimumSize

addChildren(children, nrows=None, ncols=None)#

Add the children in the grid layout.

Parameters:
  • children (list[Widget]) – The items to be added in the layout.

  • nrows (int) – The number of rows in the grid.

  • ncols (int) – The number of columns in the grid.

setProperties(kwds)#

Internal method called from constructors.

property border#

The spacing around the sides.

property margin#

The spacing around the sides.

property resizeMode#

The widget is not constrained. Minimum: size > minimumSize Maximum: size < maximumSize MinAndMaxSize: minimumSize < size < maximumSize Fixed: Fixed at SizeHint() and cannot be resized. Auto: size > minimumSize

Type:

FreeResize

property spacing#

The spacing between widgets.