TermTk.TTkLayouts.gridlayout

Grid Layout [Tutorial]

TTkGridLayout

class TTkGridLayout(*args, **kwargs)[source]

The grid layout allows an automatic place all the widgets in a grid, <br/> the empty rows/cols are resized to the “rowMinHeight,columnMinWidth” parameters

TTkGridLayout        ┌┐ columnMinWidth
 ╔═════════╤═════════╤╤═════════╗
 ║ Widget1 │ Widget2 ││ Widget3 ║
 ║ (0,0)   │ (0,1)   ││ (0,3)   ║
 ╟─────────┼─────────┼┼─────────╢ ┐ rowMinHeight
 ╟─────────┼─────────┼┼─────────╢ ┘
 ║ Widget4 │         ││         ║
 ║ (2,0)   │         ││         ║
 ╟─────────┼─────────┼┼─────────╢
 ║         │         ││ Widget5 ║
 ║         │         ││ (3,3)   ║
 ╚═════════╧═════════╧╧═════════╝
Parameters
  • columnMinWidth (int) – the minimum width of the column, optional, defaults to 0

  • rowMinHeight (int) – the minimum height of the column, optional, defaults to 0

addItem(item, row=None, col=None, rowspan=1, colspan=1, direction=3)[source]

Add the item to this TTkGridLayout

Parameters
  • item (TTkLayoutItem) – the item to be added

  • row (int) – the row of the grid, optional, defaults to None

  • col (int) – the col of the grid, optional, defaults to None

  • rowspan (int) – the rows used by the item, optional, defaults to 1

  • colspan (int) – the cols used by the item, optional, defaults to 1

  • direction (Direction) – The direction the new item will be added if row/col are not specified, defaults to defaults to HORIZONTAL

addItems(items, row=None, col=None, rowspan=1, colspan=1, direction=3)[source]

Add the items to this TTkGridLayout

Parameters
  • items (list of TTkLayoutItem) – the items to be added

  • row (int) – the row of the grid, optional, defaults to None

  • col (int) – the col of the grid, optional, defaults to None

  • rowspan (int) – the rows used by the item, optional, defaults to 1

  • colspan (int) – the cols used by the item, optional, defaults to 1

  • direction (Direction) – The direction the new items will be added if row/col are not specified, defaults to defaults to HORIZONTAL

addWidget(widget, row=None, col=None, rowspan=1, colspan=1, direction=3)[source]

Add the widget to this TTkGridLayout, this function uses addItem()

Parameters
  • widget (TTkWidget) – the widget to be added

  • row (int) – the row of the grid, optional, defaults to None

  • col (int) – the col of the grid, optional, defaults to None

  • rowspan (int) – the rows used by the widget, optional, defaults to 1

  • colspan (int) – the cols used by the widget, optional, defaults to 1

  • direction (Direction) – The direction the new item will be added if row/col are not specified, defaults to defaults to HORIZONTAL

addWidgets(widgets, row=None, col=None, rowspan=1, colspan=1, direction=3)[source]

Add the widgets to this TTkGridLayout, this function uses addItem()

Parameters
  • widgets (list of TTkWidget) – the widgets to be added

  • row (int) – the row of the grid, optional, defaults to None

  • col (int) – the col of the grid, optional, defaults to None

  • rowspan (int) – the rows used by the widget, optional, defaults to 1

  • colspan (int) – the cols used by the widget, optional, defaults to 1

  • direction (Direction) – The direction the new items will be added if row/col are not specified, defaults to defaults to HORIZONTAL

insertWidget(index, widget)
insertWidgets(index, widgets)
layer()
lowerWidget(widget)
maximumHeight() int[source]

process the widgets and get the min size

maximumWidth() int[source]

process the widgets and get the min size

minimumHeight() int[source]

process the widgets and get the min size

minimumWidth() int[source]

process the widgets and get the min size

parent()
raiseWidget(widget)
removeItem(item)[source]
removeItems(items)[source]
removeWidget(widget)[source]

Remove a widget from this Layout

Parameters

widget (TTkWidgets) – the widget to be removed

removeWidgets(widgets)[source]

Remove a list of widget from this Layout

Parameters

widgets (list of TTkWidgets) – the widget to be removed

setGeometry(x, y, w, h)
setLayer(layer)
setOffset(x, y)
setParent(parent)