示例#1
0
#!/usr/bin/env python
import sys
if sys.version_info[0] < 3:
    import PySimpleGUI27 as sg
else:
    import PySimpleGUI as sg

tab1_layout =  [[sg.T('This is inside tab 1')]]

tab2_layout = [[sg.T('This is inside tab 2')],
               [sg.In(key='in')]]

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()
    print(b,v)
    if b is None:           # always,  always give a way out!
        break
示例#2
0
    import PySimpleGUI27 as sg
else:
    import PySimpleGUI as sg

sg.ChangeLookAndFeel('GreenTan')
tab2_layout = [[sg.T('This is inside tab 2')],
               [sg.T('Tabs can be anywhere now!')]]

tab1_layout = [[sg.T('Type something here and click button'), sg.In(key='in')]]

tab3_layout = [[sg.T('This is inside tab 3')]]
tab4_layout = [[sg.T('This is inside tab 4')]]

tab_layout = [[sg.T('This is inside of a tab')]]
tab_group = sg.TabGroup(
    [[sg.Tab('Tab 7', tab_layout),
      sg.Tab('Tab 8', tab_layout)]])

tab5_layout = [[sg.T('Watch this window')], [sg.Output(size=(40, 5))]]
tab6_layout = [[sg.T('This is inside tab 6')],
               [sg.T('How about a second row of stuff in tab 6?'), tab_group]]

layout = [
    [sg.T('My Window!')],
    [
        sg.Frame('A Frame',
                 layout=[[
                     sg.TabGroup([[
                         sg.Tab('Tab 1', tab1_layout),
                         sg.Tab('Tab 2', tab2_layout)
                     ]]),