Esempio n. 1
0
def openFileBox():
    layout = [[sg.T('Source Folder')], [sg.In()],
              [sg.FileBrowse(target=(-1, 0)),
               sg.OK()]]
    window = sg.Window("Choose File", layout)
    event, values = window.Read()
    if event == "OK":
        return values
    else:
        return 0
Esempio n. 2
0
def SecondForm():

    layout = [[
        sg.Text(
            'The second form is small \nHere to show that opening a window using a window works'
        )
    ], [sg.OK()]]

    window = sg.Window('Second Form').Layout(layout)
    b, v = window.Read()
Esempio n. 3
0
plt.gca().yaxis.set_minor_formatter(NullFormatter())
# Adjust the subplot layout, because the logit one may take more space
# than usual, due to y-tick labels like "1 - 10^{-3}"
plt.subplots_adjust(top=0.92, bottom=0.08, left=0.10, right=0.95, hspace=0.25,
                    wspace=0.35)


#------------------------------- END OF YOUR MATPLOTLIB CODE -------------------------------

# ****** Comment out this line if not using Pyplot ******
fig = plt.gcf()      # if using Pyplot then get the figure from the plot

# -------------------------------- GUI Starts Here -------------------------------#
# fig = your figure you want to display.  Assumption is that 'fig' holds the      #
#       information to display.                                                   #
# --------------------------------------------------------------------------------#
figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds
# define the form layout
layout = [[sg.Text('Plot test')],
          [sg.Canvas(size=(figure_w, figure_h), key='canvas')],
          [sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]]

# create the form and show it without the plot
window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI').Layout(layout).Finalize()

# add the plot to the window
fig_photo = draw_figure(window.FindElement('canvas').TKCanvas, fig)

# show it all again and get buttons
button, values = window.Read()
Esempio n. 4
0
#!/usr/bin/env python
import sys
if sys.version_info[0] < 3:
    import PySimpleGUI27 as sg
else:
    import PySimpleGUI as sg

layout = [[sg.Text('Filename', )],
          [sg.Input(), sg.FileBrowse()],
          [sg.OK(), sg.Cancel()]]

button, (number,) = sg.Window('Get filename example').LayoutAndRead(layout)



import PySimpleGUI as sg

button, (filename,) = sg.Window('Get filename example').LayoutAndRead(
    [[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()]])
Esempio n. 5
0
import PySimpleGUI27 as sg

form = sg.FlexForm('My first GUI')

layout = [[sg.Text('Enter your name'), sg.InputText()], [sg.OK()]]

button, (name, ) = form.LayoutAndRead(layout)
Esempio n. 6
0
#!/usr/bin/env python
import sys
if sys.version_info[0] < 3:
    import PySimpleGUI27 as sg
else:
    import PySimpleGUI as sg

sg.ChangeLookAndFeel('BlueMono')

# Column layout
col = [[sg.Text('col Row 1', text_color='white', background_color='blue')],
       [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')],
       [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]]
# Window layout
layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'),
                      select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20, 3)),
           sg.Column(col, background_color='blue')],
          [sg.Input('Last input')],
          [sg.OK()]]

# Display the window and get values
button, values = sg.Window('Compact 1-line form with column').Layout(layout).Read()

sg.Popup(button, values, line_width=200)