tardis.visualization.widgets.util module¶
Utility classes and functions for widgets.
- class tardis.visualization.widgets.util.TableSummaryLabel(target_table, table_col_widths, label_key, label_value)[source]¶
Bases:
object
Label like widget to show summary of a qgrid table widget.
Also handles aligning the label with the table columns exactly like a summary row.
- update_and_resize(value)[source]¶
Update the label value and resize it as per the size of target table.
Resizing is done in such a way so as to match the width of components of label with columns of target table, making it look like another row. This method should be called whenever there is any update in data or layout of target table.
- Parameters
- valueint
Value to be shown in label
- tardis.visualization.widgets.util.create_table_widget(data, col_widths, table_options=None, changeable_col=None)[source]¶
Create table widget object which supports interaction and updating the data.
- Parameters
- datapandas.DataFrame
Data you want to display in table widget
- col_widthslist
A list containing width of each column of data in order (including the index as 1st column). The width values must be proportions of 100 i.e. they must sum to 100.
- table_optionsdict, optional
A dictionary to specify options to use when creating interactive table widget (same as :grid_options: of qgrid, specified in Notes section of their API documentation <https://qgrid.readthedocs.io/en/latest/#qgrid.show_grid>_). Invalid keys will have no effect and valid keys will override or add to the options used by this function.
- changeable_coldict, optional
A dictionary to specify the information about column which will change its name when data in generated table widget updates. It must have two keys -
index
to specify index of changeable column in dataframedata
as an integer, andother_names
to specify all possible names changeable column will get as a list of strings. Default valueNone
indicates that there is no changable column.
- Returns
- qgrid.QgridWidget
Table widget object