Пример #1
0
def GetFilesToCompare():
    form_rows = [[sg.Text('Enter 2 files to comare')],
                 [
                     sg.Text('File 1', size=(15, 1)),
                     sg.InputText(key='file1'),
                     sg.FileBrowse()
                 ],
                 [
                     sg.Text('File 2', size=(15, 1)),
                     sg.InputText(key='file2'),
                     sg.FileBrowse(target='file2')
                 ], [sg.Submit(), sg.Cancel()]]

    window = sg.Window('File Compare')
    button, values = window.Layout(form_rows).Read()
    return button, values
Пример #2
0
def addClient():
    layout = [
        [sg.Text('Please enter the IP address and email')],
        [sg.Text('IP Address:', size=(15, 1)),
         sg.InputText('', key='_IP_')],
        [sg.Text('Email:', size=(15, 1)),
         sg.InputText('', key='_EMAIL_')], [sg.Submit(),
                                            sg.Cancel()]
    ]
    window = sg.Window('Add Account', layout)
    event, values = window.Read()
    window.Close()
    if (sg.PopupYesNo("Are you sure?") == "Yes"):
        return values
    else:
        pass
Пример #3
0
def addAccount():  #add email account to the "Available" section
    layout = [[sg.Text('Please enter the email address and password')],
              [
                  sg.Text('Email Address:', size=(15, 1)),
                  sg.InputText('', key='_EMAIL_')
              ],
              [
                  sg.Text('Password:'******'', key='_PASSWORD_')
              ], [sg.Submit(), sg.Cancel()]]
    window = sg.Window('Add Account', layout)
    event, values = window.Read()
    window.Close()
    if (sg.PopupYesNo("Are you sure?") == "Yes"):
        return values
    else:
        pass
Пример #4
0
def startup():
    layout = [[sg.Text('Please enter the name of your server:')],
              [sg.InputText()], [sg.Submit(), sg.Cancel()]]
    window = sg.Window('Project0', layout)
    event, values = window.Read()
    window.Close()
    ServerName = values[0]
    return ServerName
Пример #5
0
    def PlayerChooseSongGUI(self):

        # ---------------------- DEFINION OF CHOOSE WHAT TO PLAY GUI ----------------------------

        layout = [[
            sg.Text('MIDI File Player',
                    font=("Helvetica", 15),
                    size=(20, 1),
                    text_color='green')
        ], [sg.Text('File Selection', font=("Helvetica", 15), size=(20, 1))],
                  [
                      sg.Text('Single File Playback', justification='right'),
                      sg.InputText(size=(65, 1), key='midifile'),
                      sg.FileBrowse(size=(10, 1),
                                    file_types=(("MIDI files", "*.mid"), ))
                  ],
                  [
                      sg.Text('Or Batch Play From This Folder',
                              auto_size_text=False,
                              justification='right'),
                      sg.InputText(size=(65, 1), key='folder'),
                      sg.FolderBrowse(size=(10, 1))
                  ], [sg.Text('_' * 250, auto_size_text=False, size=(100, 1))],
                  [
                      sg.Text('Choose MIDI Output Device', size=(22, 1)),
                      sg.Listbox(values=self.PortList,
                                 size=(30, len(self.PortList) + 1),
                                 key='device')
                  ], [sg.Text('_' * 250, auto_size_text=False, size=(100, 1))],
                  [
                      sg.SimpleButton('PLAY',
                                      size=(12, 2),
                                      button_color=('red', 'white'),
                                      font=("Helvetica", 15),
                                      bind_return_key=True),
                      sg.Text(' ' * 2, size=(4, 1)),
                      sg.Cancel(size=(8, 2), font=("Helvetica", 15))
                  ]]

        window = sg.Window('MIDI File Player',
                           auto_size_text=False,
                           default_element_size=(30, 1),
                           font=("Helvetica", 12)).Layout(layout)
        self.Window = window
        return window.Read()
Пример #6
0
def start_app():
    layout = [[
        sg.Text('Enter the last four of your phone number',
                size=(75, 1),
                justification='center',
                font=("Helvetica", 18))
    ],
              [
                  sg.Text('', size=(35, 1)),
                  sg.InputText(font=("Helvetica", 18),
                               justification='center',
                               size=(30, 1),
                               key='input_box')
              ],
              [
                  sg.Text('', size=(35, 1)),
                  sg.ReadButton('Submit'),
                  sg.Text('', size=(18, 1)),
                  sg.ReadButton('Clear')
              ], [sg.Exit(key='Exit')]]

    window = sg.Window('Log In/Out',
                       auto_size_buttons=False,
                       return_keyboard_events=True).Layout(layout)

    while True:
        button, values = window.Read()

        if button == 'Exit' or values is None:
            break
        elif button == 'Clear':
            element = window.FindElement('input_box')
            element.Update('')
        elif button == 'Submit' or ord(str(button)) == 13:
            phone_number = values['input_box']
            try:
                int(phone_number)
                if int(phone_number) > 9999:
                    sg.Popup('Enter last four of your phone number.')
                elif len(phone_number) < 4:
                    sg.Popup('Enter last four of your phone number.')
                else:
                    failed = fetch_user(phone_number)
                    if failed:
                        sg.Popup('Invalid phone number.')

                    element = window.FindElement('input_box')
                    element.Update('')
            except:
                sg.Popup('Number values only.')
                element = window.FindElement('input_box')
                element.Update('')
#!/usr/bin/env python
import sys
if sys.version_info[0] < 3:
    import PySimpleGUI27 as sg
else:
    import PySimpleGUI as sg
"""
    Simple Form showing how to use keys on your input fields
"""

layout = [[sg.Text('Please enter your Name, Address, Phone')],
          [sg.Text('Name', size=(15, 1)),
           sg.InputText('1', key='name')],
          [sg.Text('Address', size=(15, 1)),
           sg.InputText('2', key='address')],
          [sg.Text('Phone', size=(15, 1)),
           sg.InputText('3', key='phone')], [sg.Submit(),
                                             sg.Cancel()]]

window = sg.Window('Simple Data Entry Window').Layout(layout)
button, values = window.Read()

sg.Popup(button, values, values['name'], values['address'], values['phone'])
Пример #8
0
                size=(10, 1))
    ], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')],
    [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')],
    [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]
]

layout = [
    [sg.Menu(menu_def, tearoff=True)],
    [
        sg.Text('All graphic widgets in one form!',
                size=(30, 1),
                justification='center',
                font=("Helvetica", 25),
                relief=sg.RELIEF_RIDGE)
    ], [sg.Text('Here is some text.... and a place to enter text')],
    [sg.InputText('This is my text')],
    [
        sg.Frame(layout=[[
            sg.Checkbox('Checkbox', size=(10, 1)),
            sg.Checkbox('My second checkbox!', default=True)
        ],
                         [
                             sg.Radio('My first Radio!     ',
                                      "RADIO1",
                                      default=True,
                                      size=(10, 1)),
                             sg.Radio('My second Radio!', "RADIO1")
                         ]],
                 title='Options',
                 title_color='red',
                 relief=sg.RELIEF_SUNKEN,
Пример #9
0
sys_tcl = os.path.join(os.path.dirname(sys.executable), "tcl")
tk = os.path.join(sys_tcl, tk_lq)
tcl = os.path.join(sys_tcl, tcl_lq)
tkinter_available = os.path.exists(tk) and os.path.exists(tcl)
if not tkinter_available:
    try:
        tk = os.environ["TCL_LIBRARY"]
        tcl = os.environ["TCL_LIBRARY"]
        tkinter_available = os.path.exists(tk) and os.path.exists(tcl)
    except:
        pass


message = sg.Text("", size=(60, 1))
frm_input = sg.InputText("", key="py-file", do_not_clear=False)
frm_output = sg.InputText("", key="compile-to", do_not_clear=True)
frm_icon = sg.InputText("", key="icon-file", do_not_clear=True)
frm_follow = sg.InputText("", size=(60, 2), key="follow", do_not_clear=True)
frm_no_follow = sg.InputText("", size=(60, 2), key="no-follow", do_not_clear=True)
frm_packages = sg.InputText("", size=(60, 2), key="packages", do_not_clear=True)
frm_modules = sg.InputText("", size=(60, 2), key="modules", do_not_clear=True)
frm_plugins = sg.InputText("", size=(60, 2), key="plugin-dir", do_not_clear=True)
frm_more = sg.InputText("", key="add-args", size=(60, 2), do_not_clear=True)
form = sg.FlexForm("Nuitka Standalone EXE Generation")

compile_to = pscript = icon_file = ""

layout = [
    [
        sg.Text("Python Script:", size=(13, 1)),
Пример #10
0
        layout = [[
            sg.Graph(canvas_size=(400, 400),
                     graph_bottom_left=(-200, -200),
                     graph_top_right=(200, 200),
                     background_color='red',
                     key='graph',
                     enable_events=True,
                     drag_submits=True)
        ],
                  [
                      sg.Button("land", key="LAND"),
                      sg.Button("go up", key="UP"),
                      sg.Button("go down", key="DOWN")
                  ],
                  [
                      sg.InputText("45", key="YAW"),
                      sg.Button("SEND_YAW", key="SEND_YAW")
                  ]]
        window = sg.Window('Graph test', layout, finalize=True)
        graph = window['graph']

        oval1 = graph.draw_oval((-5, 0), (5, 50),
                                fill_color='purple',
                                line_color='purple')
        oval3 = graph.draw_oval((0, 5), (50, -5),
                                fill_color='purple',
                                line_color='purple')
        oval2 = graph.draw_oval((5, 0), (-5, -50),
                                fill_color='blue',
                                line_color='blue')
        oval4 = graph.draw_oval((0, -5), (-50, 5),
# Workbook vars
cwd = os.getcwd()
# template = os.path.join(cwd + '\\template', 'Clarity_BOM_Template.xlsx')
template = os.path.join(cwd, 'Clarity_BOM_Template.xlsx')
wb = load_workbook(filename=template)
ws = wb['Sheet1']

# sg initialization
interpreter = executable
path_to_interpreter = path.dirname(interpreter)
sitepkg = path_to_interpreter + "\\site-packages"
addsitedir(sitepkg)
import arcpy # Apparently need to put the import arcpy statement after the sg initialization for desktop app to work.

gui = [[sg.Text('Input GDB', size=(20, 1)), sg.InputText(size=(70, 1)), sg.FolderBrowse()],
       [sg.Text('BOM Output Location:', size=(20, 1)), sg.InputText(size=(70, 1)), sg.FolderBrowse()],
       [sg.Text('OLT(s) Comma Separated:', size=(20, 1)), sg.InputText(size=(70, 1))],
       [sg.Submit(), sg.Exit()]]

window = sg.Window('Clarity BOM (Simplified)').Layout(gui)
scratchExists = os.path.exists(os.path.join(r'C:\Users', getpass.getuser(), 'Documents', 'ArcGIS','scratch.gdb'))
if scratchExists == False:
    arcpy.CreateFileGDB_management(os.path.join(r'C:\Users', getpass.getuser(), 'Documents', 'ArcGIS'), 'scratch.gdb')
else:
    pass
scratch = os.path.join(r'C:\Users', getpass.getuser(), 'Documents', 'ArcGIS','scratch.gdb')

##################################################################

def clear_scratch():
Пример #12
0
#master=tk.Tk()
#tk.Label(master, text=" finestra 1").grid(row=0)
#tk.Label(master, text=" finestra 2").grid(row=1)

#e1=tk.Entry(master)
#e2=tk.Entry(master)

#e1.grid(row=0, column=1)
#e2.grid(row=1, column=1)

#master.mainloop()
# continue from https://www.python-course.eu/tkinter_entry_widgets.php
#_______________________________________
# GUI
layout = [[sg.Text('Insert Company Name, name of the job, link')],
          [sg.Text('Company Name', size=(15, 1)),
           sg.InputText('name')],
          [sg.Text('Name of the job', size=(15, 1)),
           sg.InputText('address')],
          [sg.Text('link', size=(15, 1)),
           sg.InputText('phone')], [sg.Submit(), sg.Cancel()]]

window = sg.Window('Job Apllications').Layout(layout)
button, values = window.Read()

print(button, values[0], values[1], values[2])

#__________________________
#workbook = xlwt.Workbook()
#sheet = workbook.add_sheet("Sheet Name")
Пример #13
0
 layout = [[
     sg.Graph(canvas_size=(400, 400),
              graph_bottom_left=(-200, -200),
              graph_top_right=(200, 200),
              background_color='red',
              key='graph',
              enable_events=True,
              drag_submits=True)
 ],
           [
               sg.Button("land", key="LAND"),
               sg.Button("go up", key="UP"),
               sg.Button("go down", key="DOWN")
           ],
           [
               sg.InputText("45", key="YAW"),
               sg.Button("SEND_YAW", key="SEND_YAW")
           ],
           [
               sg.InputText("0",
                            size=(10, 10),
                            tooltip="K_P",
                            key="K_P"),
               sg.InputText("0",
                            size=(10, 10),
                            tooltip="K_I",
                            key="K_I"),
               sg.InputText("0",
                            size=(10, 10),
                            tooltip="K_D",
                            key="K_D"),
Пример #14
0

sys_tcl = os.path.join(os.path.dirname(sys.executable), "tcl")
tk = os.path.join(sys_tcl, tk_lq)
tcl = os.path.join(sys_tcl, tcl_lq)
tkinter_available = os.path.exists(tk) and os.path.exists(tcl)
if not tkinter_available:
    try:
        tk = os.environ["TCL_LIBRARY"]
        tcl = os.environ["TCL_LIBRARY"]
        tkinter_available = os.path.exists(tk) and os.path.exists(tcl)
    except:
        pass

message = sg.Text("", size=(60, 1))
frm_input = sg.InputText("", key="py-file", do_not_clear=False)
frm_output = sg.InputText("", key="compile-to", do_not_clear=True)
frm_icon = sg.InputText("", key="icon-file", do_not_clear=True)
frm_follow = sg.InputText("", size=(60, 2), key="follow", do_not_clear=True)
frm_no_follow = sg.InputText("",
                             size=(60, 2),
                             key="no-follow",
                             do_not_clear=True)
frm_packages = sg.InputText("",
                            size=(60, 2),
                            key="packages",
                            do_not_clear=True)
frm_modules = sg.InputText("", size=(60, 2), key="modules", do_not_clear=True)
frm_plugins = sg.InputText("",
                           size=(60, 2),
                           key="plugin-dir",
        count += 1
        predicted = final.loc[(final['Hotel_Address'] == hotel),
                              'New_Rate'].iat[0]
        actual = test.loc[(test['Hotel_Address'] == hotel), 'Rate'].iat[0]
        sum += math.pow(predicted - actual, 2)
    intermediate = sum / count
    rmse = math.sqrt(intermediate)
    return round(rmse, 6)


# the user interface to allow user input
layout = [
    [sg.Text('Where would you like to fly to?')],
    [
        sg.Text('User ID', size=(22, 1), tooltip='Input your User ID'),
        sg.InputText('')
    ],
    [
        sg.Text('Country/City Destination',
                size=(22, 1),
                tooltip='Where do you want to go?'),
        sg.InputText('')
    ],
    [
        sg.Text('Travel Type', size=(22, 1)),
        sg.InputCombo(
            ('Solo traveler', 'Couple', 'Group', 'Family with older children',
             'Family with young children'),
            size=(20, 3))
    ],
    [
Пример #16
0
# Very basic window.  Return values using auto numbered keys

layout = [
    [sg.Text('Enter the parameters to run the models:', size=(35, 1))],
    [
        sg.Drop(values=('Tea Preparation Activity', 'Washing Hands Activity',
                        'Dressing Activity'),
                auto_size_text=True)
    ],  #0
    [
        sg.Drop(values=('MCI', 'Mild AD', 'Moderate AD', 'Severe AD'),
                auto_size_text=True)
    ],  #1
    [sg.Text('# People', size=(20, 1)),
     sg.InputText()],  #2
    [sg.Text('Advanced parameters for the Declarative Memory Module:')],
    [
        sg.Text('Chunk Activation Transitory Noise e:', size=(30, 1)),
        sg.InputText()
    ],  #3
    [sg.Text('Strength of Association S:', size=(25, 1)),
     sg.InputText()],  # 4
    [sg.Text('Attentional Weight W:', size=(25, 1)),
     sg.InputText()],  # 5
    [sg.Text('Strength of Similarity P:', size=(25, 1)),
     sg.InputText()],  # 6
    [sg.Text('Similarity of Chunks:', size=(25, 1)),
     sg.InputText()],  # 7
    [sg.Text('Advanced parameters for the Production Module:')],  #
    [sg.Text('Production Utility Noise e:', size=(25, 1)),
Пример #17
0
		setpoint_pos.set(0.0, 0.0, 2.0, wait=True)

		rospy.loginfo("## finalizing module of position control")
		setpoint_pos.finish()

		rospy.loginfo("## Initiating module of velocity control")
		setpoint_vel.init(0.0, 0.0, 2.0)
		setpoint_vel.start()

		_X_SIZE = 4
		_Y_SIZE = 4

		layout = [[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-200, -200), graph_top_right=(200, 200), background_color='red', key='graph', enable_events=True, drag_submits=True)],
		          [sg.Button("land", key="LAND"), sg.Button("go up", key="UP"), sg.Button("go down", key="DOWN")],
				  [sg.Button("ACTIVATE_FUZZY", key="ACTIVATE_FUZZY"), sg.Button("DEACTIVATE_FUZZY", key="DEACTIVATE_FUZZY")],
		          [sg.InputText("45", key="YAW"), sg.Button("SEND_YAW", key="SEND_YAW")],
		          [sg.InputText(KPx, size=(10,10), tooltip="K_P", key="K_P"),
				   sg.InputText(KIx, size=(10,10), tooltip="K_I", key="K_I"),
				   sg.InputText(KDx, size=(10,10), tooltip="K_D", key="K_D"), sg.Button("SEND_PID", key="SEND_PID")]]
		window = sg.Window('Drone control view', layout, finalize=True)
		graph = window['graph']

		oval1 = graph.draw_oval((-5, 0), (5, 50), fill_color='purple', line_color='purple')
		oval3 = graph.draw_oval((0, 5), (50, -5), fill_color='purple', line_color='purple')
		oval2 = graph.draw_oval((5, 0), (-5, -50), fill_color='blue', line_color='blue')
		oval4 = graph.draw_oval((0, -5), (-50, 5), fill_color='blue', line_color='blue')
		circleSize = 15
		circle = graph.draw_circle((0, 0), circleSize, fill_color='black', line_color='green')

		pointSize = 10
		point = graph.draw_point([0, 0], pointSize, color='green')
Пример #18
0
        string = ""
        for i in result:
            if i != "":
                string += i.capitalize() + " "
        string = string[:-1]
        print string
    """

    window_layout = [[
        gui.Frame(
            "",
            layout=[[gui.Text("What if the past really defined the future?")],
                    [gui.Text("Press submit and find out! Keyword optional.")],
                    [
                        gui.InputText(default_text="",
                                      size=(54, 1),
                                      key="keyword",
                                      do_not_clear=True)
                    ], [gui.Button("Submit", size=(46, 2))],
                    [
                        gui.Multiline(default_text="",
                                      do_not_clear=True,
                                      size=(52, 10),
                                      key="output")
                    ]])
    ]]

    window_title = "News Predictor"
    window = gui.Window(window_title).Layout(window_layout)

    #indow.FindElement("error_box").Update(value=ERROR_MESSAGE, append=True)
    'installmethod'
]
sc_fields = [
    "fdhid", "locationdescription", "splice_type", "fcount", "splice_count",
    "fiber_assignments", "sc_size"
]
vault_fields = ["fdhid", "layer", "structure_type", "pvault", 'interconnect']
trench_fields = ["fdhid", "length_geo"]
loop_fields = [
    "fdhid", "designid", "p_hierarchy", "cablecapacity", "measuredlength"
]

layout = [[sg.Text('Fill in the fields below', size=(45, 1))],
          [
              sg.Text('Input GDB:', size=(20, 1)),
              sg.InputText(size=(70, 1)),
              sg.FolderBrowse()
          ],
          [
              sg.Text('Output Location:', size=(20, 1)),
              sg.InputText(size=(70, 1)),
              sg.FolderBrowse()
          ],
          [
              sg.Text('FDH list(comma separted):', size=(20, 1)),
              sg.InputText(size=(70, 1))
          ], [sg.Submit(), sg.Exit()]]

window = sg.Window('Fort Collins BOM Tool').Layout(layout)

codeblock = '''
import Tkinter
import json
import re
import string
import random
import time
import sys
from Tkinter import *
import Pmw, sys
import PySimpleGUI27 as sg

boyut = [
    [sg.Text('Boyut Seciniz')],  #GUI
    [
        sg.Text('Row Sayisi', size=(15, 1)),
        sg.InputText(size=(15, 1)),
    ],
    [
        sg.Text('Col Sayisi', size=(15, 1)),
        sg.InputText(size=(15, 1)),
    ],
    [sg.Submit('BULMACA OLUSTUR')]
]

window2 = sg.Window('Boyut Belirle', boyut)

event, values = window2.read()

en = int(values[0])
boy = int(values[1])
Пример #21
0
def Everything():
    sg.ChangeLookAndFeel('TanBlue')

    column1 = [[
        sg.Text('Column 1',
                background_color=sg.DEFAULT_BACKGROUND_COLOR,
                justification='center',
                size=(10, 1))
    ],
               [
                   sg.Spin(values=('Spin Box 1', '2', '3'),
                           initial_value='Spin Box 1',
                           key='spin1')
               ],
               [
                   sg.Spin(values=('Spin Box 1', '2', '3'),
                           initial_value='Spin Box 2',
                           key='spin2')
               ],
               [
                   sg.Spin(values=('Spin Box 1', '2', '3'),
                           initial_value='Spin Box 3',
                           key='spin3')
               ]]

    layout = [
        [
            sg.Text('All graphic widgets in one form!',
                    size=(30, 1),
                    font=("Helvetica", 25))
        ], [sg.Text('Here is some text.... and a place to enter text')],
        [sg.InputText('This is my text', key='in1', do_not_clear=True)],
        [
            sg.Checkbox('Checkbox', key='cb1'),
            sg.Checkbox('My second checkbox!', key='cb2', default=True)
        ],
        [
            sg.Radio('My first Radio!     ',
                     "RADIO1",
                     key='rad1',
                     default=True),
            sg.Radio('My second Radio!', "RADIO1", key='rad2')
        ],
        [
            sg.Multiline(
                default_text=
                'This is the default Text should you decide not to type anything',
                size=(35, 3),
                key='multi1',
                do_not_clear=True),
            sg.Multiline(default_text='A second multi-line',
                         size=(35, 3),
                         key='multi2',
                         do_not_clear=True)
        ],
        [
            sg.InputCombo(('Combobox 1', 'Combobox 2'),
                          key='combo',
                          size=(20, 1)),
            sg.Slider(range=(1, 100),
                      orientation='h',
                      size=(34, 20),
                      key='slide1',
                      default_value=85)
        ],
        [
            sg.InputOptionMenu(
                ('Menu Option 1', 'Menu Option 2', 'Menu Option 3'),
                key='optionmenu')
        ],
        [
            sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'),
                       size=(30, 3),
                       key='listbox'),
            sg.Slider(
                range=(1, 100),
                orientation='v',
                size=(5, 20),
                default_value=25,
                key='slide2',
            ),
            sg.Slider(
                range=(1, 100),
                orientation='v',
                size=(5, 20),
                default_value=75,
                key='slide3',
            ),
            sg.Slider(range=(1, 100),
                      orientation='v',
                      size=(5, 20),
                      default_value=10,
                      key='slide4'),
            sg.Column(column1, background_color='gray34')
        ], [sg.Text('_' * 80)], [sg.Text('Choose A Folder', size=(35, 1))],
        [
            sg.Text('Your Folder',
                    size=(15, 1),
                    auto_size_text=False,
                    justification='right'),
            sg.InputText('Default Folder', key='folder', do_not_clear=True),
            sg.FolderBrowse()
        ],
        [
            sg.ReadButton('Exit'),
            sg.Text(' ' * 40),
            sg.ReadButton('SaveSettings'),
            sg.ReadButton('LoadSettings')
        ]
    ]

    window = sg.Window('Form Fill Demonstration',
                       default_element_size=(40, 1),
                       grab_anywhere=False)
    # button, values = window.LayoutAndRead(layout, non_blocking=True)
    window.Layout(layout)

    while True:
        button, values = window.Read()

        if button is 'SaveSettings':
            filename = sg.PopupGetFile('Save Settings',
                                       save_as=True,
                                       no_window=True)
            window.SaveToDisk(filename)
            # save(values)
        elif button is 'LoadSettings':
            filename = sg.PopupGetFile('Load Settings', no_window=True)
            window.LoadFromDisk(filename)
            # load(form)
        elif button in ['Exit', None]:
            break
Пример #22
0
def gui():

    #  Gui to get dates from the user
    dates = []
    layout = [[sg.Text('GBO Master Calibration Finder', font=('Helvetica', 25), justification='center')],
              [sg.Text('_' * 100, size=(65, 1))],
              [sg.Text('Enter the dates of science images', font=('Helvetica', 14))],
              [sg.T('Format: 20180715'), sg.T('Added Date', size=(19,1), justification='right')],
              [sg.InputText('', size=(12, 1), key='datein'),
              sg.T('', size=(20, 1), justification='right', key='dateout')],
              [sg.Submit('Add Date')],
              [sg.Button('Next'), sg.Button('Exit')]]

    window = sg.Window('Window Title').Layout(layout)

    while True:  # Event Loop
        event, values = window.Read()
        print event, values
        if event is None or event == 'Exit':
            print '\nClosing program based on "Exit" command'
            sys.exit(1)
            break
        if event == 'Next':
            break
        if event == 'Add Date':
            dates.append(values['datein'])
            window.Element('dateout').Update(values['datein'])

    window.Close()


    #  Gui to get Path, Binning, and Temp from user
    layout = [[sg.Text('GBO Master Calibration Finder', font=('Helvetica', 25), justification='center')],
              [sg.Text('_' * 100, size=(65, 1))],
              [sg.Text('Enter output path for your files', font=('Helvetica', 12))],
              [sg.InputText(outdir, size=(45, 1), key='path'), sg.Text('Leave as is for default')],
              [sg.Text('_' * 100, size=(65, 1))],
              [sg.Text('Select the type of master frames to find', font=('Helvetica', 14))],
              [sg.Checkbox('Bias', default=True, size=(12, 1), key='Bias'),
               sg.Checkbox('Dark', default=True, size=(12, 1), key='Dark'),
               sg.Checkbox('Flat', default=True, size=(12, 1), key='Flat')],
              [sg.Text('_' * 100, size=(65, 1))],
              [sg.Text('Select the Binning', font=('Helvetica', 14))],
              [sg.Radio('1X1', "RADIO1", default=True, key='1X1'), sg.Radio('2X2', "RADIO1", key='2X2'),
               sg.Radio('3X3', "RADIO1", key='3X3'), sg.Radio('4X4', "RADIO1", key='4X4')],
              [sg.Text('_' * 100, size=(65, 1))],
              [sg.Text('Select the Temp', font=('Helvetica', 14))],
              [sg.Radio('-25', "RADIO2", default=True, key='-25'), sg.Radio('-30', "RADIO2", key='-30'),
               sg.Radio('-35', "RADIO2", key='-35')],
              [sg.Submit(), sg.Button('Exit')]]

    window = sg.Window('GBO Master Calibration Finder', font=("Helvetica", 12)).Layout(layout)

    event, values = window.Read()
    if event == 'Exit':
        print '\nClosing program based on "Exit" command'
        sys.exit(2)

    window.Close()

    types = ['Bias', 'Dark', 'Flat']
    types = [x for x in types if values[x] == True]
    binning = [x for x in bins if values[x] == True]
    binning = binning[0]
    temp = [x for x in temps if values[x] == True]
    temp = temp[0]

    outpath = values['path']
    if not outpath.endswith('\\'):
        outpath = outpath + '\\'


    #  Gui to get dark exposure times from the user
    if 'Dark' in types:
        darkbin = dark_files.where(done_files['binning'] == binning)
        darkbin.dropna(how='all', inplace=True)
        darktemp = darkbin.where(darkbin['temp'] == temp)
        darktemp.dropna(how='all', inplace=True)

        exposures = np.sort(darktemp['exp'].unique())

        layout = [[sg.Text('GBO Master Calibration Finder', font=('Helvetica', 25), justification='center')],
                  [sg.Text('Your Binning is:'), sg.Text(binning)],
                  [sg.Text('Your Temp is:', size=(12,1)), sg.Text(temp)],
                  [sg.Text('',size=(15,1)), sg.Text('Available Exposures')],
                  [sg.Text('', size=(16,1)),
                   sg.Listbox(exposures, size=(10,12), select_mode='multiple', key='exposures')],
                  [sg.Submit(), sg.Button('Exit')]]

        window = sg.Window('GBO Master Calibration Finder', font=("Helvetica", 12)).Layout(layout)

        event, values = window.Read()

        window.Close()

        if event == 'Exit':
            print '\nClosing program based on "Exit" command'
            sys.exit(3)

        exposures = values['exposures']
    else:
        exposures = []

    #  Gui to get filters from the user
    if 'Flat' in types:
        flatbin = flat_files.where(done_files['binning'] == binning)
        flatbin.dropna(how='all', inplace=True)
        flattemp = flatbin.where(flatbin['temp'] == temp)
        flattemp.dropna(how='all', inplace=True)

        filters = np.sort(flattemp['filter'].unique())

        layout = [[sg.Text('GBO Master Calibration Finder', font=('Helvetica', 25), justification='center')],
                  [sg.Text('Your Binning is:'), sg.Text(binning)],
                  [sg.Text('Your Temp is:', size=(12,1)), sg.Text(temp)],
                  [sg.Text('',size=(15,1)), sg.Text('Available Filters')],
                  [sg.Text('', size=(16,1)),
                   sg.Listbox(filters, size=(10,12), select_mode='multiple', key='filters')],
                  [sg.Submit(), sg.Button('Exit')]]

        window = sg.Window('GBO Master Calibration Finder', font=("Helvetica", 12)).Layout(layout)

        event, values = window.Read()

        window.Close()

        if event == 'Exit':
            print '\nClosing program based on "Exit" command'
            sys.exit(4)

        filters = values['filters']
    else:
        filters = []

    return types, outpath, binning, temp, dates, exposures, filters
Пример #23
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)