Tables¶
Contents
Summary
Adds a simple table that can hold text. |
|
Get/set which cells are selected in a |
Simple Tables¶
- class dearpygui_obj.tables.Table(headers: Union[int, Iterable[str]] = 2, **config: Any)[source]¶
Bases:
dearpygui_obj.wrapper.widget.Widget,dearpygui_obj.wrapper.widget.ItemWidgetMxAdds a simple table that can hold text.
A Table’s data consists of a sequence of rows, each row being a sequence of strings.
Note that a Table has two different kinds of “columns”. A Table will have a number of data columns and a number of header columns.
These won’t always match. If you have more data columns than header columns, only a subsection of the data will actually get shown. This will be the case even if
hide_headersisTrue.- Parameters
headers – can be an iterable of header strings or an integer. If an integer is used, it will set the number of header columns and the
hide_headersproperty will be set toTrue.
To get/set values in the table, indexing syntax can be used. For example:
table[2, 3] = 'cell content' table[3, :] = ['sets', 'an', 'entire', 'row'] table[:, 4] = ['sets', 'an', 'entire', 'column'] table[:, :] = [['first', row'], ['second', 'row'], ['third', 'row]]
Cell selection state can also be modified in a similar manner.
table.selection[1, :] = True # selects the entire second row.
- selected: TableSelection¶
A
TableSelectioninstance that can be used to get or modify the table’s cell selection state.
- set_headers(headers: Union[Iterable[str], int]) None[source]¶
Set the table headers.
This determines the number of displayed columns (distinct from the number of data columns!). If an integer is passed, the headers will be replaced with empty strings and hidden.
- property rows: int¶
The number of data rows.
- property columns: int¶
The number of data columns.
- __getitem__(indices: Tuple[int, int]) str[source]¶
- __getitem__(indices: Tuple[int, slice]) Sequence[str]
- __getitem__(indices: Tuple[slice, int]) Sequence[str]
- __getitem__(indices: Tuple[slice, slice]) Sequence[Sequence[str]]
Get table data using indices or slices.
- __setitem__(indices: Tuple[int, int], value: str) None[source]¶
- __setitem__(indices: Tuple[int, slice], value: Iterable[str]) None
- __setitem__(indices: Tuple[slice, int], value: Iterable[str]) None
- __setitem__(indices: Tuple[slice, slice], value: Iterable[Iterable[str]]) None
Set table data using indices or slices. The shape of the value argument must match the provided indices/slices.
- class dearpygui_obj.tables.TableSelection(table: dearpygui_obj.tables.Table)[source]¶
Bases:
objectGet/set which cells are selected in a
Table.