Ejemplo n.º 1
0
def creategui():
    sg.ChangeLookAndFeel('BlueMono')

    frame_layout = [
        [sg.T('Elapsed', size=(60, 1), key='-ELAPSED-')],
        [sg.Multiline('', size=(60, 12), autoscroll=True, key='-ML-')],
    ]

    # define the window layout
    layout = [[
        sg.Text('OMRON HVC P2 Demo GUI',
                size=(50, 1),
                justification='center',
                font='Helvetica 20')
    ], [sg.Image(filename='', key='image'),
        sg.Frame('Result', frame_layout)],
              [
                  sg.ReadButton('Exit',
                                size=(10, 1),
                                pad=((0, 0), 3),
                                font='Helvetica 14'),
                  sg.RButton('Pause',
                             key='-RUN-PAUSE-',
                             size=(10, 1),
                             font='Any 14')
              ]]

    # create the window and show it without the plot
    window = sg.Window('OMRON HVC P2 Demo Application', location=(400, 200))
    #window.Layout(layout).Finalize()
    window.Layout(layout)

    return window
Ejemplo n.º 2
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
Ejemplo n.º 3
0
                         sg.Tab('Tab 1', tab1_layout),
                         sg.Tab('Tab 2', tab2_layout)
                     ]]),
                     sg.TabGroup([[
                         sg.Tab('Tab3', tab3_layout),
                         sg.Tab('Tab 4', tab4_layout)
                     ]])
                 ]])
    ],
    [
        sg.T('This text is on a row with a column'),
        sg.Column(layout=[[sg.T('In a column')],
                          [
                              sg.TabGroup([[
                                  sg.Tab('Tab 5', tab5_layout),
                                  sg.Tab('Tab 6', tab6_layout)
                              ]])
                          ], [sg.RButton('Click me')]])
    ],
]

window = sg.Window('My window with tabs',
                   default_element_size=(12, 1)).Layout(layout).Finalize()

print('Are there enough tabs for you?')

while True:
    button, values = window.Read()
    print(button, values)
    if button is None:  # always,  always give a way out!
        break
Ejemplo n.º 4
0
layout = [[
    sg.Text('Hover mouse to see RGB value, click for white & black text',
            text_color='blue',
            font='Any 15',
            relief=sg.RELIEF_SUNKEN,
            justification='center',
            size=(100, 1),
            background_color='light green',
            pad=(0, (0, 20))),
]]
row = []
# -- Create primary color viewer window --
for i, color in enumerate(color_map):
    row.append(
        sg.RButton(color,
                   button_color=('black', color),
                   key=color,
                   tooltip=color_map[color]))
    if (i + 1) % 15 == 0:
        layout.append(row)
        row = []

window = sg.Window('Color Viewer', grab_anywhere=False,
                   font=('any 9')).Layout(layout)

# -- Event loop --
while True:
    b, v = window.Read()
    if b is None:
        break
    # -- Create a secondary window that shows white and black text on chosen color
    layout2 = [[
          'grey20', 'grey21', 'grey22', 'grey23', 'grey24', 'grey25', 'grey26', 'grey27', 'grey28',
          'grey29', 'grey30', 'grey31', 'grey32', 'grey33', 'grey34', 'grey35', 'grey36', 'grey37',
          'grey38', 'grey39', 'grey40', 'grey42', 'grey43', 'grey44', 'grey45', 'grey46', 'grey47',
          'grey48', 'grey49', 'grey50', 'grey51', 'grey52', 'grey53', 'grey54', 'grey55', 'grey56',
          'grey57', 'grey58', 'grey59', 'grey60', 'grey61', 'grey62', 'grey63', 'grey64', 'grey65',
          'grey66', 'grey67', 'grey68', 'grey69', 'grey70', 'grey71', 'grey72', 'grey73', 'grey74',
          'grey75', 'grey76', 'grey77', 'grey78', 'grey79', 'grey80', 'grey81', 'grey82', 'grey83',
          'grey84', 'grey85', 'grey86', 'grey87', 'grey88', 'grey89', 'grey90', 'grey91', 'grey92',
          'grey93', 'grey94', 'grey95', 'grey97', 'grey98', 'grey99']

sg.SetOptions(button_element_size=(12,1), element_padding=(0,0), auto_size_buttons=False, border_width=0)

layout = [[sg.Text('Click on a color square to see both white and black text on that color', text_color='blue', font='Any 15')]]
row = []
# -- Create primary color viewer window --
for i, color in enumerate(COLORS):
    row.append(sg.RButton(color, button_color=('black', color), key=color))
    if (i+1) % 12 == 0:
        layout.append(row)
        row = []

window = sg.Window('Color Viewer', grab_anywhere=False, font=('any 9')).Layout(layout)

# -- Event loop --
while True:
    b, v = window.Read()
    if b is None:
        break
    # -- Create a secondary window that shows white and black text on chosen color
    layout2 =[[sg.Button(b, button_color=('white', b)), sg.Button(b, button_color=('black', b))] ]
    sg.Window('Buttons with white and black text', keep_on_top=True).Layout(layout2).Read()