Web Analytics Made Easy - Statcounter
Skip to content

Tab

Tab call reference

Tabs are another of PySimpleGUI "Container Elements". The Tab contains a layout just as the other Container Elements do. A Tab element is not used directly in a layout. It will always be used in combination with a Tabgroup Element..

tab_layout1 = [[sg.Button('My first Button!'), sg.Checkbox('My first Checkbox!')],
               [sg.Button('Another Button.')]]
tab_layout2 = [[sg.Button('My third Button!'), sg.Checkbox('My second Checkbox!')]]

layout = [[sg.TabGroup([[sg.Tab("Tab 1", tab_layout1), sg.Tab("Tab 2", tab_layout2)]])]]

Events

The Tab element does not generate events by itself, however, it can cause a TabGroup to generate events when the tab is activated.

Values Dictionary

There is no Values Dictionary entry for the Tab element. The key for the Tab element may show up in the Values Dictionary in the entry for the TabGroup it belongs to. If the Tab is selected, then its key will be the value for the TabGroup element in the dictionary.

TabGroup Integration

The TabGroup and the Tab elements are tightly integrated. You'll need to careful look at both elements to understand how best to complete the desired operation.

A couple of examples.... the location of a Tab (top, left, etc) is determined by a TabGroup setting. Whether or not a Tab is visible in the group is determined by the visible parameter for the Tab.

Overall, the TabGroup determines how the Tabs behave while the settings for the Tab involve how a Tab looks and contents of the layout within that Tab.