diff --git a/Demo_Tabs.py b/Demo_Tabs.py index 142f42f2..9a8e30be 100644 --- a/Demo_Tabs.py +++ b/Demo_Tabs.py @@ -5,26 +5,47 @@ if sys.version_info[0] >= 3: else: import PySimpleGUI27 as sg -tab1_layout = [[sg.T('This is inside tab 1')]] +sg.SetOptions(background_color='cornsilk4', element_background_color='cornsilk2', input_elements_background_color='cornsilk2') -tab2_layout = [[sg.T('This is inside tab 2')], +tab1_layout = [[sg.T('This is inside tab 1', background_color='darkslateblue', text_color='white')], + [sg.In(key='_in0_')]] + +tab2_layout = [[sg.T('This is inside tab 2', background_color='tan1')], [sg.In(key='_in2_')]] + tab3_layout = [[sg.T('This is inside tab 3')], + [sg.In(key='_in2_')]] + +tab4_layout = [[sg.T('This is inside tab 4', background_color='darkseagreen')], [sg.In(key='_in3_')]] -tab4_layout = [[sg.T('This is inside tab 4')], +tab5_layout = [[sg.T('This is inside tab 5')], [sg.In(key='_in4_')]] -layout = [[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout, key='_mykey_'), sg.Tab('Tab 2', tab2_layout)]], key='_group2_', background_color='green', tab_location='top')], -[sg.TabGroup([[sg.Tab('Tab 3', tab3_layout, key='_mykey_'), sg.Tab('Tab 4', tab4_layout)]], key='_group1_', tab_location='right')], - [sg.RButton('Read')]] +layout = [[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout, background_color='darkslateblue', key='_mykey_'), + sg.Tab('Tab 2', tab2_layout, background_color='tan1'), + sg.Tab('Tab 3', tab3_layout)]], + key='_group2_', title_color='red', + selected_title_color='green', tab_location='right'), + sg.TabGroup([[sg.Tab('Tab 4', tab4_layout,background_color='darkseagreen', key='_mykey_'), + sg.Tab('Tab 5', tab5_layout)]], key='_group1_', tab_location='top', selected_title_color='purple')], + [sg.TabGroup([[sg.Tab('Tab 1', tab1_layout, background_color='darkslateblue', key='_mykey_'), + sg.Tab('Tab 2', tab2_layout, background_color='tan1'), + sg.Tab('Tab 3', tab3_layout)]], + key='_group3_', title_color='red', + selected_title_color='green', tab_location='left'), + sg.TabGroup([[sg.Tab('Tab 4', tab4_layout,background_color='darkseagreen', key='_mykey_'), + sg.Tab('Tab 5', tab5_layout)]], key='_group4_', tab_location='bottom', selected_title_color='purple')], + [sg.RButton('Read')]] window = sg.Window('My window with tabs', default_element_size=(12,1)).Layout(layout) + while True: b, v = window.Read() + sg.PopupNonBlocking(b,v) print(b,v) if b is None: # always, always give a way out! - break \ No newline at end of file + break diff --git a/Demo_Tabs_Simple.py b/Demo_Tabs_Simple.py new file mode 100644 index 00000000..0e687e31 --- /dev/null +++ b/Demo_Tabs_Simple.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +import sys +if sys.version_info[0] >= 3: + import PySimpleGUI as sg +else: + import PySimpleGUI27 as sg + +tab1_layout = [[sg.T('Tab 1')], + [sg.T('Put your layout in here')], + [sg.T('Input something'),sg.In(key='_in0_')]] + +tab2_layout = [[sg.T('Tab2')]] + + +layout = [[sg.TabGroup([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]])], + [sg.RButton('Read')]] + +window = sg.Window('My window with tabs', default_element_size=(12,1)).Layout(layout) + + +while True: + b, v = window.Read() + sg.PopupNonBlocking('button = %s'%b,'Values dictionary', v) + print(b,v) + if b is None: # always, always give a way out! + break