Fixed layout-reuse error in the Nested Tabs demo. Added comment block.. .surprised no one noticed... may be time for a $5 prize again in the code
This commit is contained in:
parent
ea7c4d46e7
commit
50a83202af
|
@ -1,7 +1,21 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
import PySimpleGUI as sg
|
import PySimpleGUI as sg
|
||||||
|
|
||||||
# Yet another example of TabGroup element
|
"""
|
||||||
|
Demo - Yet another example of TabGroup element
|
||||||
|
|
||||||
|
These are simple tabs and tab groups. This example simply shows groups within groups.
|
||||||
|
Be careful with tabs to make sure you don't re-use a layout. If you used a layout in one tab
|
||||||
|
you cannot use it again in another tab.
|
||||||
|
|
||||||
|
There was an error in this demo for quite some time that makes for a great example of this error.
|
||||||
|
|
||||||
|
See how tab_layout is in both Tab elements? That's a no-go and you'll get an error poup
|
||||||
|
|
||||||
|
tab_group = sg.TabGroup([[sg.Tab('Tab 7', tab_layout), sg.Tab('Tab 8', tab_layout)]])
|
||||||
|
|
||||||
|
Copyright 2022 PySimpleGUI
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
sg.theme('GreenTan')
|
sg.theme('GreenTan')
|
||||||
tab2_layout = [[sg.Text('This is inside tab 2')],
|
tab2_layout = [[sg.Text('This is inside tab 2')],
|
||||||
|
@ -12,11 +26,12 @@ tab1_layout = [[sg.Text('Type something here and click button'), sg.Input(key='i
|
||||||
tab3_layout = [[sg.Text('This is inside tab 3')]]
|
tab3_layout = [[sg.Text('This is inside tab 3')]]
|
||||||
tab4_layout = [[sg.Text('This is inside tab 4')]]
|
tab4_layout = [[sg.Text('This is inside tab 4')]]
|
||||||
|
|
||||||
tab_layout = [[sg.Text('This is inside of a tab')]]
|
tab_layout7 = [[sg.Text('This is inside of a tab')]]
|
||||||
tab_group = sg.TabGroup([[sg.Tab('Tab 7', tab_layout), sg.Tab('Tab 8', tab_layout)]])
|
tab_layout8 = [[sg.Text('This is inside of a tab')]]
|
||||||
|
tab_group = sg.TabGroup([[sg.Tab('Tab 7', tab_layout7), sg.Tab('Tab 8', tab_layout8)]])
|
||||||
|
|
||||||
tab5_layout = [[sg.Text('Watch this window')],
|
tab5_layout = [[sg.Text('Watch this window')],
|
||||||
[sg.Output(size=(40,5))]]
|
[sg.Output(size=(40,5))]] # generally better to use a Multline, but for super-simple examples, Output is OK
|
||||||
tab6_layout = [[sg.Text('This is inside tab 6')],
|
tab6_layout = [[sg.Text('This is inside tab 6')],
|
||||||
[sg.Text('How about a second row of stuff in tab 6?'), tab_group]]
|
[sg.Text('How about a second row of stuff in tab 6?'), tab_group]]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue