PySimpleGUI/docs/eCookbook/tables/table-element-getting-click...

17 lines
845 B
Markdown
Raw Normal View History

2022-06-30 19:30:25 +00:00
# Table Element
## Click Events
In relerase 4.48.0 a new parameter was added for all those Table Element fans out there.
The boolean parameter `enable_click_events` in the Table element enables clicks of individual cells and the table headers to be detected and returned to you. This is exactly what's needed if you want to sort your table by columns for example.
This example code can also be found in the Demo Programs section on the PySimpleGUI GitHub at http://demos.PySimpleGUI.org
The Demo Program is named `Demo_Table_Element_Header_or_Cell_Clicks.py`
Here's the demo code ready for you to run. Try clicking on the Column Headers to sort by that column.
500
<iframe src='https://trinket.io/embed/pygame/baca37f8b2?start=result' width='100%' height='500' frameborder='0' marginwidth='0' marginheight='0' allowfullscreen></iframe>