Merge pull request #5543 from PySimpleGUI/Dev-latest

Updated to show some of the newer parms
This commit is contained in:
PySimpleGUI 2022-06-02 13:26:32 -04:00 committed by GitHub
commit f3a745bb63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 6 deletions

View File

@ -5,9 +5,10 @@ import string
"""
Basic use of the Table Element
Copyright 2022 PySimpleGUI
"""
sg.theme('Dark Red')
# ------ Some functions to help generate data for the table ------
def word():
@ -28,23 +29,30 @@ headings = [str(data[0][x])+' ..' for x in range(len(data[0]))]
# ------ Window Layout ------
layout = [[sg.Table(values=data[1:][:], headings=headings, max_col_width=25,
# background_color='light blue',
auto_size_columns=True,
# cols_justification=('l','c','r','c', 'r', 'r'), # Added on GitHub only as of June 2022
display_row_numbers=True,
justification='right',
num_rows=20,
alternating_row_color='lightyellow',
alternating_row_color='lightblue',
key='-TABLE-',
row_height=35,
selected_row_colors='red on yellow',
enable_events=True,
expand_x=False,
expand_y=True,
vertical_scroll_only=False,
enable_click_events=True, # Comment out to not enable header and other clicks
tooltip='This is a table')],
[sg.Button('Read'), sg.Button('Double'), sg.Button('Change Colors')],
[sg.Text('Read = read which rows are selected')],
[sg.Text('Double = double the amount of data in the table')],
[sg.Text('Change Colors = Changes the colors of rows 8 and 9')]]
[sg.Text('Change Colors = Changes the colors of rows 8 and 9'), sg.Sizegrip()]]
# ------ Create Window ------
window = sg.Window('The Table Element', layout,
# ttk_theme='clam',
# font='Helvetica 25',
resizable=True
)
# ------ Event Loop ------
@ -61,3 +69,4 @@ while True:
window['-TABLE-'].update(row_colors=((8, 'white', 'red'), (9, 'green')))
window.close()