Web Analytics Made Easy - Statcounter
Skip to content

Table

Table Element

Table(
    values,
    headings = None,
    visible_column_map = None,
    col_widths = None,
    def_col_width = 10,
    auto_size_columns = True,
    max_col_width = 20,
    select_mode = None,
    display_row_numbers = False,
    num_rows = None,
    font = None,
    justification = "right",
    header_text_color = None,
    header_background_color = None,
    header_font = None,
    text_color = None,
    background_color = None,
    alternating_row_color = None,
    size = (None, None),
    change_submits = False,
    enable_events = False,
    bind_return_key = False,
    pad = None,
    key = None,
    k = None,
    tooltip = None,
    visible = True,
    size_px = (None, None),
    metadata = None
)

Parameter Descriptions

Name Type Default Description
alternating_row_color str None if set then every other row will have this color in the background.
auto_size_columns bool True if True columns will be sized automatically
background_color str None color of background
bind_return_key bool False if True, pressing return key will cause event coming from Table, ALSO a left button double click will generate an event if this parameter is True
change_submits bool False DO NOT USE. Only listed for backwards compat - Use enable_events instead
col_widths List[int] None Number of characters that each column will occupy
def_col_width int 10 Default column width in characters
display_row_numbers bool False if True, the first column of the table will be the row #
enable_events bool False Turns on the element specific events. Table events happen when row is clicked
font (str or (str, int[, str]) or None) None specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
header_background_color str None sets the background color for the header
header_font (str or (str, int[, str]) or None) None specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
header_text_color str None sets the text color for the header
headings List[str] None The headings to show on the top line
justification str right 'left', 'right', 'center' are valid choices
k str or int or tuple or object None Same as the Key. You can use either k or key. Which ever is set will be used.
key str or int or tuple or object None Used with window.find_element and with return values to uniquely identify this element to uniquely identify this element
max_col_width int 20 Maximum width for all columns in characters
metadata Any None User metadata that can be set to ANYTHING
num_rows int None The number of rows of the table to display at a time
pad (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) None Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int)
select_mode enum None Select Mode. Valid values start with "TABLE_SELECT_MODE_". Valid values are: TABLE_SELECT_MODE_NONE TABLE_SELECT_MODE_BROWSE TABLE_SELECT_MODE_EXTENDED
size (int, int) (None, None) DO NOT USE! Use num_rows instead
size_px (int, int) or (None, None) (None, None) w=pixels-wide, h=pixels-high
text_color str None color of the text
tooltip str None text, that will appear when mouse hovers over the element
values List[List[str or int or float]] Your table data represented as a 2-dimensions table... a list of rows, with each row representing a row in your table.
visible bool True set visibility state of the element
visible_column_map List[bool] None One entry for each column. False indicates the column is not shown

Class Properties

This class has no public properties

Class Methods

 def expand
 def get
 def get_stylesheet
 def set_stylesheet
 def update

expand

WARNING - NOT USED IN PySimpleGUIQt port. Provided as dummy method

expand(
    expand_x = False,
    expand_y = False,
    expand_row = True
)

Parameter Descriptions

Name Type Default Description
expand_row bool True If True the row containing the element will also expand. Without this your element is "trapped" within the row
expand_x bool False If True Element will expand in the Horizontal directions
expand_y bool False If True Element will expand in the Vertical directions
RETURN None None

get

In the Qt port you can read back the values in the table in case they were edited.

get()

Parameter Descriptions

Name Type Default Description
RETURN List[List[Any]] the current table values (for now what was originally provided up updated)

get_stylesheet

Returns the stylesheet for element's associated Qt Widget

get_stylesheet()

Parameter Descriptions

Name Type Default Description
RETURN str stylesheet

set_stylesheet

Sets the stylesheet for a Qt Widget

set_stylesheet(
    stylesheet
)

Parameter Descriptions

Name Type Default Description
stylesheet str Stylesheet (string) to set stylesheet to

update

Changes some of the settings for the Table Element. Must call Window.Read or Window.Finalize prior

Changes will not be visible in your window until you call window.read or window.refresh.

If you change visibility, your element may MOVE.

update(
    values = None,
    num_rows = None,
    visible = None
)

Parameter Descriptions

Name Type Default Description
num_rows int None How many rows to display at a time
values List[List[str or int or float]] None A new 2-dimensional table to show
visible bool None if True then will be visible