Table (hwx.gui)

A Table widget used to display/edit a list of list of values.

Inherits:

Public Methods

addColumn (self, *values)
addRow (self, *values)
clearSelection (self)
getColumnWidth (self, col=’all’)
getRowHeight (self, row=’all’)
getSelectedRows (self, full=False)
getValue (self, row, col)
isSelected (self, row, col)
removeColumn (self, indices)
removeRow (self, indices)
selectCells (self, row=’all’, col=’all’, select=True, clear=True)
selectRow (self, row, clear=True)
selectRows (self, rows=[], clear=True)
setColumnWidth (self, width, col=’all’)
setRowHeight (self, height=20, row=’all’)
setValue (self, row, col, value)
setValues (self, values, rowOrder=False)
unselectCells (self, row=’all’, col=’all’)

Property Details

columnLabels()

Column labels to use for resulting table.

columnStretchability()

A list describing whether each column is stretchable or not. If the table widget’s width decreases or increases stretchable columns will grow narrower or wider to fit the space available as completely as possible. The user cannot manually resize stretchable columns.

Returns:
list[bool]: A list describing whether each column is stretchable or not.
columnWidth()

The width of each column of the table.

numCols()

The number of columns in the table.

numRows()

The number of rows in the table.

readOnly()

Determines whether the cells are readonly or not.

rowHeight()

The height of each row of the table.

rowLabels()

Index to use for resulting table.

rowStretchability()

A list describing whether each row is stretchable or not. If the table widget’s width decreases or increases stretchable rows will grow narrower or wider to fit the space available as completely as possible. The user cannot manually resize stretchable rows.

Returns:
list[bool]: A list describing whether each column is stretchable or not.
selectionBehavior()

Determines the way the items of the table can be selected.

Args:
value (Table.selectionBehaviorType): The type of selection to allow.
selectionMode()

Determines the way the items of the table can be selected.

Args:
value (Table.selectionModeType): The type of selection to allow.
shape()

The dimensionality of the table.

Method Details

addColumn(self, *values)

Appends a column of values.

param values:The values to be set in column of the table
type values:list[list[str]]
addRow(self, *values)

Appends a row of values.

param values:The values to be set in row of the table
type values:list[list[str]]
clearSelection(self)

Unselects all cells.

getColumnWidth(self, col='all')

Gets the width of the column.

param col:The indices of columns. Defaults to “all”
type col:Union[str, int, list[int]]
returns:The width of the column.
rtype:int
getRowHeight(self, row='all')

Gets the row height.

param row:A list of indices of rows. Defaults to “all”.
type row:Union[str, int, list[int]]
getSelectedRows(self, full=False)

Returns a list of row indices that are selected.

param full:If full is False, then if at least one cell in the row has to selected to return the row index. If full is True, then every cell in the row must be selected to return the row index.
type full:bool
getValue(self, row, col)

Gets the value from the specified row and column.

param row:The row index of the table.
type row:int
param col:The column index of the table.
type col:int
returns:The text at the specified row and column.
rtype:str
isSelected(self, row, col)

Returns True if the specified cell is selected, False otherwise.

param row:The index of row.
type row:int
param col:The index of col.
type col:int
removeColumn(self, indices)

Removes a column or columns based on their indices.

param indices:The indices of columns to be removed from the table.
type indices:Union[list[int], int]
removeRow(self, indices)

Removes a row or rows based on their indices.

param indices:The indices of rows to be removed from the table.
type indices:Union[list[int], int]
selectCells(self, row='all', col='all', select=True, clear=True)

Selects the specified cells.

param row:The indices of rows. Defaults to “all”.
type row:Union[str, int, list[int]]
param col:The indices of columns. Defaults to “all”.
type col:Union[str, int, list[int]]
param select:Determines whether the specified cells will be selected. Defaults to True.
type select:bool
param clear:Determines whether the previously selected will be cleared. Defaults to True.
type clear:bool
selectRow(self, row, clear=True)

Selects all cells of a row and ensures the row is visible.

param row:The row to be selected.
type row:int
param clear:Determines whether the previously selected will be cleared. Defaults to True.
type clear:bool
selectRows(self, rows=[], clear=True)

Selects all specified rows.

param row:The rows to be selected.
type row:list
param clear:Determines whether the previously selected will be cleared. Defaults to False.
type clear:bool
setColumnWidth(self, width, col='all')

Sets the column width.

param width:The width the column.
type width:int
param col:The indices of columns. Defaults to “all”.
type col:Union[str, int, list[int]]
setRowHeight(self, height=20, row='all')

Sets specific row height.

param height:height to set the rows. Defaults to 20.
type height:int
param row:A list of indices of rows. Defaults to “all”.
type row:Union[str, int, list[int]]
setValue(self, row, col, value)

Sets the value from the specified row and column.

param row:The row index of the table.
type row:int
param col:The column index of the table.
type col:int
param value:The value to be set.
type value:str
setValues(self, values, rowOrder=False)

Sets the cell text from the list of list of values.

param values:The values to be set in cell of the table
type values:list[list[str]]
param rowOrder:Determines if values will be transposed. Defaults to False.
type rowOrder:bool
unselectCells(self, row='all', col='all')

Deselects the specified cells.

param row:The indices of rows. Defaults to “all”.
type row:Union[str, int, list[int]]
param col:The indices of columns. Defaults to “all”.
type col:Union[str, int, list[int]]