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:
        event, values = window.Read()

        if event == 'SaveSettings':
            filename = sg.PopupGetFile('Save Settings', save_as=True, no_window=True)
            window.SaveToDisk(filename)
            # save(values)
        elif event == 'LoadSettings':
            filename = sg.PopupGetFile('Load Settings', no_window=True)
            window.LoadFromDisk(filename)
            # load(form)
        elif event in ('Exit', None):
            break
Exemple #2
0
def seleccion(dicc):
    cant = {}
    result = dicc.keys()
    lista = []
    for elem in result:
        agregado = []
        for i in range(len(dicc[elem])):
            agregado.append(i+1)
        lista.append(agregado)
    layout = [[sg.Text('Adjetivos    ',background_color='#b3d4fc'),  sg.InputOptionMenu(lista[0],background_color='#AEA79F'), sg.InputOptionMenu(colores,default_value=colores[0],background_color='#AEA79F')], 
    [sg.Text('Sustantivos',background_color='#b3d4fc'), sg.InputOptionMenu(lista[1],background_color='#AEA79F'), sg.InputOptionMenu(colores,default_value=colores[1],background_color='#AEA79F')],
    [sg.Text('Verbos       ',background_color='#b3d4fc'), sg.InputOptionMenu(lista[2],background_color='#AEA79F'), sg.InputOptionMenu(colores,default_value=colores[2],background_color='#AEA79F')],
    [sg.Radio('Mayuscula', 'RADIO2', default=True,background_color='#b3d4fc'), sg.Radio('Minuscula', 'RADIO2',background_color='#b3d4fc')],
    [sg.Radio('Horizontal', 'RADIO1', default = True ,background_color='#b3d4fc'), sg.Radio('Vertical', 'RADIO1',background_color='#b3d4fc')],
    [sg.Checkbox('Ayuda',background_color='#b3d4fc')],
    [sg.Button('Enviar', button_color=('black','#AEA79F')), sg.Button('Salir', button_color=('black','#AEA79F')), sg.Button('?', button_color=("White", "Red"))]]

    window = sg.Window('Cantidad de palabras a buscar', default_element_size=(200, 200), grab_anywhere=False,background_color='#b3d4fc').Layout(layout)
    while True:
        event, values = window.Read()
        cant['adjetivo'] = { 'cantidad': int(values[0]), 'color': colors[colores.index(values[1])]}
        cant['sustantivo'] = { 'cantidad': int(values[2]), 'color': colors[colores.index(values[3])] }
        cant['verbo'] = { 'cantidad': int(values[4]), 'color': colors[colores.index(values[5])] }
        cant['mayuscula'] = True if values[6] else False
        cant['Horizontal'] = True if values[8] else False
        cant['ayuda'] = True if values[10] else False
        if event == 'Salir':
            return None
        if event == '?':
            sg.Popup('Configuración de la sopa:\n\n>Por cada tipo de palabra debe seleccionar la cantidad de palabras a usar y el color que se le asociará durante el juego\n>También podrá configurar la sopa de letras para que sea en minúscula o en mayúscula\n>Podrá configurar el sentido en el que aparecerán las palabras (Horizontal o vertical)\n>Puede configurar una ayuda opcional tildando la casilla "Ayuda"', title='Configuración',background_color='#b3d4fc',button_color=('black','#AEA79F'))    
        if event == 'Enviar':
            if (cant['verbo']['color'] != cant['sustantivo']['color']) and (cant['verbo']['color'] != cant['adjetivo']['color']) and (cant['sustantivo']['color'] != cant['adjetivo']['color']):
                break
            else:
                sg.Popup('Seleccionar colores distintos!!', button_type='POPUP_BUTTONS_ERROR', auto_close=True,auto_close_duration=4,icon='DEFAULT_WINDOW_ICON',background_color='#b3d4fc', button_color=('black','#AEA79F'))
    window.Close()
    return cant
Exemple #3
0
    def __init__(self):
        #Layout
        layout = [
            [
                sg.Text('Arquivo', size=(8, 0)),
                sg.Input(size=(30, 0), key='nome'),
                sg.FileBrowse()
            ],
            [
                sg.Text('Número de Moléculas', size=(8, 0)),
                sg.Input(size=(7, 0), key='nmol'),
                sg.InputOptionMenu(
                    ('298', '200', '210', '220', '230', '240', '250', '260',
                     '270', '280', '290', '300', '310', '320', '330', '340',
                     '350', '360', '370', '380', '390', '400'),
                    key='Temperatura'),
                sg.Text('°K')
            ],
            [
                sg.Text('Molécula', size=(8, 0)),
                sg.Input(size=(30, 0), key='mol'),
                sg.InputOptionMenu(('Reagente', 'Produto'), key='P-R')
            ],
            [
                sg.Button('Inserir'),
                sg.Button('Calcular'),
                sg.Button('Reiniciar')
            ],
            [
                sg.Text('Molécula', size=(10, 0)),
                sg.Text('Entalpia em kJ/mol', size=(17, 0)),
                sg.Text('Entropia em  kJ/ K/mol', size=(20, 0))
            ], [sg.Output(size=(100, 20), key='_output_')]
        ]

        #Janela
        self.janela = sg.Window("e-Gibbs v.1.0").layout(layout)
Exemple #4
0
def create_layout():
    left_column = [
        [
            sg.Text('Folder', size=(10, 1)),
            sg.InputText(enable_events=True, key=Key.folder),
            sg.FolderBrowse(initial_folder=Path('~').expanduser()),
        ],
        [
            sg.Listbox(
                values=[],
                select_mode=sg.LISTBOX_SELECT_MODE_EXTENDED,
                enable_events=True, size=(65, 20),
                key=Key.file_list,
            )
        ],
        [
            sg.Text('Set preview image max width'),
            sg.InputText('400', key=Key.width, size=(5, 1)),
            sg.Text('and height'),
            sg.InputText('800', key=Key.height, size=(5, 1)),
        ],
        [
            sg.Text('Output folder', size=(10, 1)),
            sg.InputText(Path('~').expanduser(), key=Key.output_folder),
            sg.FolderBrowse(initial_folder=Path('~').expanduser())
        ],
        [
            sg.Checkbox('Show preview', key=Key.show_preview, enable_events=True),
            sg.InputOptionMenu([CropType.separate.value, CropType.combined.value], key=Key.crop_type),
            sg.Button('Crop selected', key=Key.crop_selected),
            sg.Button('Crop all', key=Key.crop_all),
        ],
    ]
    image_column = [
        [sg.Text('Initial image')],
        [sg.Image(key=Key.image)],
    ]
    preview_column = [
        [sg.Text('Output preview')],
        [sg.Image(key=Key.preview)]
    ]

    return [[
        sg.Column(left_column, element_justification='l', vertical_alignment='top'),
        sg.VSeperator(),
        sg.Column(image_column, element_justification='c', vertical_alignment='top'),
        sg.Column(preview_column, element_justification='c', vertical_alignment='top'),
    ]]
Exemple #5
0
def input_player_number():
    layout = [
        [
            sg.Text("Player number:"),
            sg.InputOptionMenu([5, 6, 7, 8, 9, 10], key="player_number"),
        ],
        [sg.Button("Submit")],
    ]
    window = sg.Window("Resistance", layout)
    event, values = window.read()
    if event == "Submit":
        player_number = int(values["player_number"])
        window.close()
    else:
        raise Exception(f"Unknown event {event}")
    return player_number
def AllWidgetsWithContext():
    """
    Nearly All Widgets with Green Color Theme with Context Manager
    Example of nearly all of the widgets in a single form. Uses a customized color scheme. This recipe uses a context manager, the preferred method.
    """
    import PySimpleGUI as sg
    # Green & tan color scheme
    sg.ChangeLookAndFeel('GreenTan')


    # sg.ChangeLookAndFeel('GreenTan')

    with sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) as form:

        column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', 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.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')],
            [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)],
            [sg.Radio('My first Radio!     ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")],
            [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)),
             sg.Multiline(default_text='A second multi-line', size=(35, 3))],
            [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)),
             sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)],
            [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))],
            [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)),
             sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25),
             sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75),
             sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10),
             sg.Column(column1, background_color='#F7F3EC')],
            [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'), sg.FolderBrowse()],
            [sg.Submit(), sg.Cancel()]
        ]

        button, values = form.LayoutAndRead(layout)
    def __init__(self):
        layout = [
            [sg.Text('Video URL', size=(9, 0)), sg.InputText(key='videoURL')],
            [sg.Text('E-mail', size=(9, 0)), sg.InputText(key='email',
                                                          size=(35, 0), default_text="*****@*****.**")],
            [sg.Text('Password', size=(9, 0)), sg.InputText(
                key='password', size=(35, 0), password_char='*', default_text="g33888705")],
            [sg.InputOptionMenu(
                ('Passive Listening', 'Active Listening'), key='option')],
            [sg.Button('Ok', size=(9, 0))]
        ]

        sg.theme('DarkAmber')
        self.window = sg.Window('Login info', layout)
        self.button, self.values = self.window.Read()
        self.optionClassNameOnPage = {
            'Passive Listening': 'ul.nav.nav-list.conteudoItemLista.__tab-campo > li:nth-child(2)',
            'Active Listening': 'ul.nav.nav-list.conteudoItemLista.__tab-campo > li:nth-child(1)'
        }
Exemple #8
0
def get_window_new(menu):
    layout_menu = {
        'Transfer Function': [[sg.T("Fill the parameters")],
                              [sg.T('Numerator Coefficients'),
                               sg.In(key='-N_COEFF-'),
                               ],
                              [sg.T('Denominator coefficient'),
                               sg.In(key='-D_COEFF-')
                               ],
                              [sg.Button('Clear'),
                               sg.Button('Cancel'),
                               sg.Button('Apply'),
                               ]
                              ],
        'Feedback': [[sg.InputOptionMenu(('Negative',
                                          'Positive',
                                          'No Feedback'
                                          ),
                                         key='-FEEDBACK-')
                      ],
                     # TODO include the option of a trasnfer function as feedback
                     [sg.Button('Apply'),
                      sg.Button('Cancel'),
                      ]
                     ],

        'Time Delay': [[sg.T('Time delay in sec'),
                        sg.In(key='-TIME_DELAY-')],
                       [sg.Button('Clear'),
                        sg.Button('Cancel'),
                        sg.Button('Apply'),
                        ]
                       ],
        'Plot': [[sg.T('Time stop in sec'),
                  sg.In(key='-TIME_STOP-')],
                 [sg.Button('Clear'),
                  sg.Button('Cancel'),
                  sg.Button('Apply'),]
                 ],
    }
    return sg.Window( f'{menu} menu', layout_menu[menu])
Exemple #9
0
    def create_window(self, win_type='info'):
        """
        Create the GUI window layouts for the application.

        :param win_type: Type of GUI window to create. Others are "main"
        :return: Returns the layout object for a pysimplegui window
        """
        if win_type is 'info':
            port_list = serial.tools.list_ports.comports()
            com_ports = [port.device for port in port_list]
            layout = [[sg.Text('EGG101 - Data Broadcaster', font=(self.font, 16), justification='center')],
                      [sg.Text('Enter Desired Channel to Connect to:', font=(self.font, 10)),
                           sg.Input(do_not_clear=True)],
                      [sg.Text('Enter API Write Key:', font=(self.font, 10)), sg.Input(do_not_clear=True)],
                      [sg.Text('Enter API Read Key:', font=(self.font, 10)), sg.Input(do_not_clear=True)],
                      [sg.Text('Select Serial Port:', font=(self.font, 10)), sg.InputOptionMenu(com_ports)],
                      [sg.Submit(), sg.Cancel()]]
        elif win_type is 'main':
            layout = [[sg.Text('EGG101 - Data Broadcaster', font=(self.font, 16), justification='center')],
                      [sg.Cancel()]]

        return layout
def janela_inicio():
    temas = ['Black', 'BlueMono', 'BluePurple', 'BrightColors', 'BrownBlue', 'Dark', 'Dark2', 'DarkAmber',
             'DarkBlack', 'DarkBlack1', 'DarkBlue', 'DarkBlue1', 'DarkBlue10', 'DarkBlue11', 'DarkBlue12',
             'DarkBlue13', 'DarkBlue14', 'DarkBlue15', 'DarkBlue16', 'DarkBlue17', 'DarkBlue2', 'DarkBlue3',
             'DarkBlue4', 'DarkBlue5', 'DarkBlue6', 'DarkBlue7', 'DarkBlue8', 'DarkBlue9', 'DarkBrown',
             'DarkBrown1', 'DarkBrown2', 'DarkBrown3', 'DarkBrown4', 'DarkBrown5', 'DarkBrown6', 'DarkGreen',
             'DarkGreen1', 'DarkGreen2', 'DarkGreen3', 'DarkGreen4', 'DarkGreen5', 'DarkGreen6', 'DarkGrey',
             'DarkGrey1', 'DarkGrey2', 'DarkGrey3', 'DarkGrey4', 'DarkGrey5', 'DarkGrey6', 'DarkGrey7',
             'DarkPurple', 'DarkPurple1', 'DarkPurple2', 'DarkPurple3', 'DarkPurple4', 'DarkPurple5',
             'DarkPurple6', 'DarkRed', 'DarkRed1', 'DarkRed2', 'DarkTanBlue', 'DarkTeal', 'DarkTeal1',
             'DarkTeal10', 'DarkTeal11', 'DarkTeal12', 'DarkTeal2', 'DarkTeal3', 'DarkTeal4', 'DarkTeal5',
             'DarkTeal6', 'DarkTeal7', 'DarkTeal8', 'DarkTeal9', 'Default', 'Default1', 'DefaultNoMoreNagging',
             'Green', 'GreenMono', 'GreenTan', 'HotDogStand', 'Kayak', 'LightBlue', 'LightBlue1',
             'LightBlue2', 'LightBlue3', 'LightBlue4', 'LightBlue5', 'LightBlue6', 'LightBlue7',
             'LightBrown', 'LightBrown1', 'LightBrown10', 'LightBrown11', 'LightBrown12',
             'LightBrown13', 'LightBrown2', 'LightBrown3', 'LightBrown4', 'LightBrown5',
             'LightBrown6', 'LightBrown7', 'LightBrown8', 'LightBrown9', 'LightGray1',
             'LightGreen', 'LightGreen1', 'LightGreen10', 'LightGreen2', 'LightGreen3',
             'LightGreen4', 'LightGreen5', 'LightGreen6', 'LightGreen7', 'LightGreen8',
             'LightGreen9', 'LightGrey', 'LightGrey1', 'LightGrey2', 'LightGrey3',
             'LightGrey4', 'LightGrey5', 'LightGrey6', 'LightPurple', 'LightTeal',
             'LightYellow', 'Material1', 'Material2', 'NeutralBlue', 'Purple', 'Reddit',
             'Reds', 'SandyBeach', 'SystemDefault', 'SystemDefault1', 'SystemDefaultForReal',
             'Tan', 'TanBlue', 'TealMono', 'Topanga']
    tema()
    layout1 = [
        [Sg.Text('SEJA BEM VINDO!')],
        [Sg.Text('VAMOS ANALIZAR SUAS AVALIAÇÕES?')],
        [Sg.Button('ENTRAR(^)', size=(11, 0)), Sg.InputOptionMenu(temas, size=(11, 0))]
    ]
    inicio = Sg.Window('CÁLCULO MÉDIA v2.0', layout1, size=(400, 97), element_justification='center')
    event1, value1 = inicio.read()
    if event1 == 'ENTRAR(^)':
        mediauni.bduni.criar()
        inicio.close()
        janela_menu()
    if event1 == Sg.WIN_CLOSED:
        inicio.close()
#PN = team name (team)
tn1 = "NaN"
tn2 = "NaN"
tn3 = "NaN"
tn4 = "NaN"
tn5 = "NaN"
tname = "NaN"
#////////////////////////////////////////////////////////////////////
#THIS IS THE lAYOUT SECTION
#////////////////////////////////////////////////////////////////////

#GUI LAYOUT FOR MENU
M = [[sg.Text('Hello, welcome back to the College Tournament database.')],
     [sg.Text('Please Choose what side you would like to go to:')],
     [sg.InputOptionMenu(('Team', 'Individual'))],
     [sg.Submit('next'), sg.Quit('Quit')]]
#GUI LAYOUT FOR SUB-MENU FOR INDIVIDUALS
SMI = [[sg.Text('Please Choose what side you would like to go to:')],
       [
           sg.InputOptionMenu(
               ('Results Sheet', 'Results Input', 'Input', 'Looker'))
       ], [sg.Submit('next'), sg.Quit('Back')]]
#GUI LAYOUT FOR SUB-MENU FOR TEAMS
SMT = [[sg.Text('Please Choose what side you would like to go to:')],
       [
           sg.InputOptionMenu(
               ('Results Sheet', 'Results Input', 'Input', 'Looker'))
       ], [sg.Submit('next'), sg.Quit('Back')]]
#GUI LAYOUT FOR TEAM LOOKER
TF = [[sg.Text('Please find the team your looking for')], [sg.InputText('')],
def compare_proteoms_app():
    import os
    import time
    import pprint

    import PySimpleGUI as sg

    from .seq_tools import fasta_to_obj, mot_finder, mot_finder_sequent
    from .info_app import compare_proteoms_info

    sg.theme('DarkPurple6')
    stype = ['sequent', 'casual']
    ROOT = os.environ.get('ROOT')
    proteomspath = os.path.join(ROOT, "data", "proteoms")
    result_file_path = os.path.join(ROOT, "data", "user_data")
    proteoms = os.listdir(path=proteomspath)
    d_filename = d_filename = f'compare-file-{time.strftime("%m_%d_%Y-%H_%M")}'

    layout = [[
        sg.Text('FROM proteom path', size=(17, 1), font=('Helvetica', 14)),
        sg.Combo(proteoms, key="-PATHFROM-", size=(40, 1)),
        sg.FileBrowse()
    ],
              [
                  sg.Text('TO proteom path',
                          size=(17, 1),
                          font=('Helvetica', 14)),
                  sg.Combo(proteoms, key="-PATHTO-", size=(40, 1)),
                  sg.FileBrowse()
              ],
              [
                  sg.Text('Mot length', font=('Helvetica', 14)),
                  sg.Spin(values=(4, 5, 6, 7, 8, 9, 10, 11, 12),
                          key="-MOTLEN-",
                          size=(5, 1),
                          initial_value=8),
                  sg.Text("Search way", font=('Helvetica', 14)),
                  sg.InputOptionMenu(stype,
                                     key='-STYPE-',
                                     size=(10, 5),
                                     text_color='black',
                                     default_value=stype[1])
              ],
              [
                  sg.Text('File name', font=('Helvetica', 14)),
                  sg.Input(key='-FILENAME-', default_text=d_filename)
              ],
              [
                  sg.Text('Out file path',
                          size=(13, 1),
                          font=('Helvetica', 14)),
                  sg.Input(default_text=result_file_path, key='-FILEPATH-'),
                  sg.FolderBrowse()
              ],
              [
                  sg.Text('Proteom pass through', font=('Helvetica', 14)),
                  sg.ProgressBar(100,
                                 size=(34, 20),
                                 orientation='h',
                                 key='-PROTEOMPROG-')
              ],
              [
                  sg.Button('Back'),
                  sg.Button('Start', size=(60, 1)),
                  sg.Button('Info')
              ]]

    window = sg.Window('Compare proteoms', layout)

    while True:  # Event Loop
        event, values = window.read()
        # print(event, values)
        if event == sg.WIN_CLOSED:
            return 'Close'
        elif event == 'Back':
            break
        elif event == 'Info':
            window.Hide()
            compare_proteoms_info()
            window.UnHide()
        elif event == 'Start':
            counter = 0

            if values["-PATHFROM-"] in proteoms:
                proteomfrom = fasta_to_obj(
                    os.path.join(proteomspath, values["-PATHFROM-"]))
            else:
                proteomfrom = fasta_to_obj(values["-PATHFROM-"])

            if values["-PATHTO-"] in proteoms:
                proteomto = fasta_to_obj(
                    os.path.join(proteomspath, values["-PATHTO-"]))
            else:
                proteomto = fasta_to_obj(values["-PATHTO-"])

            total = len(proteomfrom) * len(proteomto)
            # print(total)
            motlen = int(values['-MOTLEN-'])
            start_time = time.time()

            if values['-STYPE-'] == 'sequent':
                for proteinfrom in proteomfrom:
                    seq1 = proteinfrom['seq']
                    mots = []
                    for proteinto in proteomto:
                        counter += 1
                        if counter % 100 == 0:
                            window['-PROTEOMPROG-'].update_bar(counter, total)
                            # print(counter)

                        if len(seq1) < motlen:
                            break
                        else:
                            res = mot_finder_sequent(seq1,
                                                     proteinto['seq'],
                                                     motlen=motlen)
                            if len(res) > 0:
                                for i in res:
                                    motobj = {
                                        'mot': i,
                                        'name': proteinto["name"],
                                        'info':
                                        f'/{proteinto["organism"]}/{proteinto["id"]}',
                                        'pos_to': proteinto['seq'].find(i)
                                    }
                                    mots.append(motobj)
                                    seq1 = seq1.replace(i, "_")
                    if len(mots) > 0:
                        for mot in mots:
                            mot.update({
                                'pos_from':
                                proteinfrom['seq'].find(mot['mot'])
                            })
                        mots = sorted(mots,
                                      key=lambda item: item["pos_from"],
                                      reverse=False)
                        proteinfrom.update({'mots': mots})

            else:  # casual type of search
                for proteinfrom in proteomfrom:
                    seq1 = proteinfrom['seq']
                    mots = []
                    for proteinto in proteomto:
                        counter += 1
                        if counter % 100 == 0:
                            window['-PROTEOMPROG-'].update_bar(counter, total)
                            # print(counter)
                        res = mot_finder(seq1, proteinto['seq'], motlen=motlen)
                        if len(res) > 0:
                            for i in res:
                                motobj = {
                                    'mot': i,
                                    'name': proteinto["name"],
                                    'info':
                                    f'/{proteinto["organism"]}/{proteinto["id"]}',
                                    'pos_to': proteinto['seq'].find(i)
                                }
                                mots.append(motobj)
                    if len(mots) > 0:
                        for mot in mots:
                            mot.update({
                                'pos_from':
                                proteinfrom['seq'].find(mot['mot'])
                            })
                        mots = sorted(mots,
                                      key=lambda item: item["pos_from"],
                                      reverse=False)
                        proteinfrom.update({'mots': mots})

            window['-PROTEOMPROG-'].update_bar(1, 1)
            outfilepath = values['-FILEPATH-']
            if values['-FILENAME-'] != d_filename:
                d_filename = values['-FILENAME-']

            filename = f'{outfilepath}/{d_filename}.csv'
            print("--- %s seconds ----" % (time.time() - start_time))
            with open(filename, 'a') as file:
                line = f'Proteom of {proteomfrom[0]["organism"]}; MOT - Positions/Protein name/Organism/Uniprot ID\n'
                file.write(line)
                for prot in proteomfrom:
                    if 'mots' in prot.keys():
                        line = f'{prot["name"]}; Mots count - {len(prot["mots"])} MOTs\n'
                        file.write(line)
                        for mot in prot['mots']:
                            line = f'[{mot["pos_from"] + 1}-{mot["pos_from"] + len(mot["mot"])}] ;{mot["mot"]} - {mot["name"]} {mot["pos_to"] + 1}-{mot["pos_to"] + len(mot["mot"])}/{mot["info"]}\n'
                            file.write(line)

    window.Close()
Exemple #13
0
             sg.InputText('', size=(15, 1), font='华文中宋, 12'),
             sg.T('本炉送电时间:', size=(15, 1), font='华文中宋, 12'),
             sg.InputText('', size=(15, 1), font='华文中宋, 12')
         ],
         [
             sg.T('铁水入炉量:', size=(15, 1), font='华文中宋, 12'),
             sg.InputText('', size=(15, 1), font='华文中宋, 12'),
             sg.T('铁水入炉温度:', size=(15, 1), font='华文中宋, 12'),
             sg.InputText('', size=(15, 1), font='华文中宋, 12')
         ],
         [
             sg.T('钢水入炉量:', size=(15, 1), font='华文中宋, 12'),
             sg.InputText('', size=(15, 1), font='华文中宋, 12'),
             sg.T('废钢种类:', size=(15, 1), font='华文中宋, 12'),
             sg.InputOptionMenu(('小型', '中型', '重型'),
                                default_value='重型',
                                size=(12, 1))
         ],
     ],
              title='炉次信息',
              title_color='white',
              relief=sg.RELIEF_SUNKEN,
              font='华文中宋, 14')
 ],
 [sg.Canvas(size=(1200, 2), background_color='#B09EA9')],
 [
     sg.Canvas(size=(700, 300), background_color='#B09EA9', key='canvas1'),
     sg.Canvas(size=(490, 300), background_color='#B09EA9', key='canvas2')
 ],
 [sg.Canvas(size=(1200, 2), background_color='#B09EA9')],
 [
Exemple #14
0
def find_prot_app():
    import os
    import time
    from .seq_tools import fasta_to_obj
    from .info_app import find_protein_info
    import PySimpleGUI as sg

    ROOT = os.environ.get('ROOT')
    params = ['name', 'id', 'organism', 'seq']
    proteomspath = os.path.join(ROOT, "data", "proteoms")
    d_filename = f'search-file-{time.strftime("%m_%d_%Y-%H_%M")}'
    proteoms = os.listdir(path=proteomspath)
    user_dir = os.path.join(ROOT, "data", "user_data")

    sg.theme('DarkPurple6')
    layout = [[
        sg.Text('Proteom', size=(14, 1), font=('Helvetica', 14)),
        sg.Combo(proteoms, size=(60, 1), key="-PROTEOM-"),
        sg.FileBrowse()
    ],
              [
                  sg.Text('Search keyword',
                          size=(14, 1),
                          font=('Helvetica', 14)),
                  sg.Input(key="-KEYWORD-", size=(45, 1)),
                  sg.Text("Search in"),
                  sg.InputOptionMenu(params,
                                     key='-SPARAM-',
                                     size=(10, 5),
                                     text_color='black',
                                     default_value=params[0])
              ],
              [
                  sg.Checkbox('Output to file',
                              key='-OUTPUT-',
                              enable_events=True,
                              font=('Helvetica', 14))
              ],
              [
                  sg.Frame(layout=[[
                      sg.Text('File destination', font=('Helvetica', 14)),
                      sg.Input(key='-FILEPATH-', default_text=user_dir),
                      sg.FolderBrowse()
                  ],
                                   [
                                       sg.Text('File name',
                                               font=('Helvetica', 14)),
                                       sg.Input(key='-FILENAME-',
                                                default_text=d_filename)
                                   ]],
                           title='Save',
                           visible=False,
                           key='-SAVEMENU-',
                           font=('Helvetica', 14))
              ],
              [
                  sg.MLine(size=(100, 12),
                           key='-ML-',
                           reroute_stdout=True,
                           write_only=True,
                           autoscroll=True,
                           auto_refresh=True)
              ],
              [
                  sg.Button("Back"),
                  sg.Button("Find", size=(70, 1), pad=(20, 1)),
                  sg.Button('Info')
              ]]

    window = sg.Window('Find Protein in Proteom', layout)

    while True:
        event, values = window.read()
        if event == sg.WIN_CLOSED:
            return 'Close'
        elif event == 'Back':
            break
        elif event == "Info":
            window.Hide()
            find_protein_info()
            window.UnHide()
        elif event == "Find":
            del values['Browse0'], values['Browse']
            if '' not in values.values():
                if values["-PROTEOM-"] in proteoms:
                    proteom = fasta_to_obj(
                        os.path.join(proteomspath, values["-PROTEOM-"]))
                else:
                    proteom = fasta_to_obj(values["-PROTEOM-"])

                pattern = values['-KEYWORD-']
                param = values['-SPARAM-']
                if param == 'seq':
                    pattern = pattern.upper()
                line0 = f'Search pattern: {pattern}, Search by {param} '
                line = f'Search pattern: {pattern}, Search by {param} '
                print(line0)

                if values['-OUTPUT-'] == True:
                    if values['-FILENAME-'] != d_filename and values[
                            '-FILENAME-'] != '':
                        d_filename = values['-FILENAME-']

                    if values['-FILEPATH-'] == user_dir:
                        filename = f'{user_dir}/{d_filename}.txt'
                    else:
                        filename = f'{values["-FILEPATH-"]}/{d_filename}.txt'

                    with open(filename, 'a') as file:
                        file.write(line0)
                        for protein in proteom:
                            if pattern in protein[param]:
                                if param == 'seq':
                                    line = f'{protein["name"]}\n{protein["organism"]}\nPositions:[{protein["seq"].find(pattern) + 1}-{protein["seq"].find(pattern) + len(pattern)}]\n{protein["id"]}\n{protein["seq"]}\n\n'
                                else:
                                    line = f'{protein["name"]}\n{protein["organism"]}\n{protein["id"]}\n{protein["seq"]}\n\n'
                                file.write(line)
                else:
                    for protein in proteom:
                        if pattern in protein[param]:
                            if param == 'seq':
                                line = f'{protein["name"]}\n{protein["organism"]}\nPositions:[{protein["seq"].find(pattern) + 1}-{protein["seq"].find(pattern) + len(pattern)}]\n{protein["id"]}\n{protein["seq"]}\n\n'
                            else:
                                line = f'{protein["name"]}\n{protein["organism"]}\n{protein["id"]}\n{protein["seq"]}\n\n'
                            print(line)
                    if line == line0 or line is None:
                        print('No results')
                print('Done')
            else:
                print("Some values are absent")
                print([i for i in values.keys() if values[i] == ''])

        elif values['-OUTPUT-'] == True:
            window['-SAVEMENU-'].Update(visible=True)

    window.Close()
Exemple #15
0
def configPalabras(dic_palabras):
    '''Modulo encargado de procesar toda la informacion relacionada a la configuracion del juego'''

    #------------------------------------ Funciones ------------------------------------
    def borrar_valor(valor, dic_palabras):
        '''borra un valor del diccionario de palabras'''

        valido = ''
        if valor in dic_palabras['__verbos__']:
            dic_palabras['__verbos__'].remove(valor)
            valido = '__verbos__'
        elif valor in dic_palabras['__adjetivos__']:
            dic_palabras['__adjetivos__'].remove(valor)
            valido = '__adjetivos__'
        elif valor in dic_palabras['__sustantivos__']:
            dic_palabras['__sustantivos__'].remove(valor)
            valido = '__sustantivos__'

        return valido

    #---------------------------- Procesamiento de temperaturas -------------------------------
    dirJsonOficinas = os.path.abspath(
        os.path.join(os.path.join(os.pardir, 'Raspberry'),
                     'datos-oficinas.json'))  #archivo en carpeta padre
    oficinas_temp = {}
    try:
        oficinas_registroAmbiental = {}
        jsonOficinas = open(dirJsonOficinas)
        oficinas_registroAmbiental = json.load(
            jsonOficinas)  #levantar json registro
        listaTemperaturas = []
        for oficina in oficinas_registroAmbiental:
            for dic_registro in oficinas_registroAmbiental[oficina]:
                listaTemperaturas.append(int(dic_registro['Temperatura']))
            oficinas_temp[oficina] = statistics.mean(
                listaTemperaturas
            )  #calcular promedio de tempemperatura de una oficina
    except:  #En caso de que no exista, valor predeterminado = 20
        oficinas_temp['Vacio'] = 20
        sg.PopupNoButtons('Registro Ambiental no encontrado o no es operable.',
                          title='Advertencia',
                          auto_close=True,
                          auto_close_duration=4
                          )  #aviso: el registro no se encontro o esta vacio

    # ------------------------------------ Layout & Design ------------------------------------

    sg.ChangeLookAndFeel('Purple')

    columna_verbos = [[
        sg.Frame('Verbos', [[
            sg.Listbox(
                dic_palabras['__verbos__'], key='__verbos__', size=(25, 5))
        ],
                            [
                                sg.Text('Cantidad:'),
                                sg.Spin([i for i in range(0, 6)],
                                        initial_value=0,
                                        size=(3, 3),
                                        key='__cantverbos__'),
                                sg.ColorChooserButton(
                                    'Elegir color',
                                    key='__verbColorChooser__',
                                )
                            ]],
                 relief=sg.RELIEF_RIDGE)
    ]]
    columna_adj = [[
        sg.Frame('Adjetivos',
                 [[
                     sg.Listbox(dic_palabras['__adjetivos__'],
                                key='__adjetivos__',
                                size=(25, 5))
                 ],
                  [
                      sg.Text('Cantidad:'),
                      sg.Spin([i for i in range(0, 6)],
                              initial_value=0,
                              size=(3, 3),
                              key='__cantadjetivos__'),
                      sg.ColorChooserButton('Elegir color',
                                            key='__adjColorChooser__')
                  ]],
                 relief=sg.RELIEF_RIDGE)
    ]]
    columna_sust = [[
        sg.Frame('Sustantivos', [[
            sg.Listbox(dic_palabras['__sustantivos__'],
                       key='__sustantivos__',
                       size=(25, 5))
        ],
                                 [
                                     sg.Text('Cantidad:'),
                                     sg.Spin([i for i in range(0, 6)],
                                             initial_value=0,
                                             size=(3, 3),
                                             key='__cantsustantivos__'),
                                     sg.ColorChooserButton(
                                         'Elegir color',
                                         key='__sustColorChooser__',
                                     )
                                 ]],
                 relief=sg.RELIEF_RIDGE)
    ]]

    Config = [[
        sg.Text(' ' * 43),
        sg.Text(
            'Ingrese de a una las palabras a utilizar (sin espacios en blanco)',
            font=('Helvetica', 11))
    ],
              [
                  sg.Text(' ' * 40),
                  sg.Input(do_not_clear=False, key='__input__'),
                  sg.Submit('Agregar', key='__addbutton__'),
                  sg.Button('Eliminar', key='__deletebutton__')
              ], [sg.Text('_' * 113)],
              [sg.Text('Palabras ingresadas', font=('Helvetica', 13))],
              [
                  sg.Column(columna_verbos),
                  sg.Column(columna_adj),
                  sg.Column(columna_sust)
              ], [sg.Text('_' * 113)],
              [
                  sg.Text('Ayuda'),
                  sg.InputOptionMenu(('Si', 'No'), key='__ayuda__'),
                  sg.Text('Orientacion'),
                  sg.InputOptionMenu(('Horizontal', 'Vertical'),
                                     key='__orientacion__'),
                  sg.Text('Letras'),
                  sg.InputOptionMenu(('Mayúsculas', 'Minúsculas'),
                                     key='__letras__'),
                  sg.Text('Oficina'),
                  sg.InputOptionMenu(values=list(oficinas_temp.keys()),
                                     key='__oficinas__'),
                  sg.Text(' ' * 5),
                  sg.Ok('Aceptar', button_color=('white', '#475841'))
              ]]

    layout_selectAyuda = [
        [sg.Text('Seleccione las ayudas a usar')],
        [
            sg.Checkbox('Definicion de palabra',
                        key='__ayudaDefinicion__',
                        default=True),
            sg.Checkbox('Lista de Palabras',
                        key='__ayudalistaPalabras__',
                        default=True)
        ],
        [sg.Submit('Aceptar')],
    ]

    # ------------------------------------ Window Loop ------------------------------------

    ventana_IngVen = sg.Window('Configuracion', layout=Config)
    window_selectAyuda = sg.Window('Ayudas', layout=layout_selectAyuda)

    while True:
        event, values = ventana_IngVen.Read()
        tipo = ''
        if event is None:
            sys.exit()
        elif event == '__addbutton__':
            valores = Web.ProcesarPalabra(values['__input__'].lower(),
                                          dic_palabras, tipo)
            if valores[0]:
                ventana_IngVen.FindElement(valores[1]).Update(
                    dic_palabras[valores[1]])
            ventana_IngVen.Refresh()

        elif event == '__deletebutton__':
            tipo_borrado = borrar_valor(values['__input__'], dic_palabras)
            if tipo_borrado != '':  #Chequear que la palabra a eliminar sea valida
                ventana_IngVen.FindElement(tipo_borrado).Update(
                    dic_palabras[tipo_borrado])
            else:
                sg.PopupError('Palabra no existente', title='')

        elif event == 'Aceptar':
            # corroborar que no se haya equivocado
            if values['__cantverbos__'] == '0' and values[
                    '__cantadjetivos__'] == '0' and values[
                        '__cantsustantivos__'] == '0':
                continuar = sg.PopupYesNo(
                    'Se eligieron 0 verbos, 0 adjetivos y 0 sustantivos. \n'
                    'Esto finalizará el juego y perderá todos los datos ingresados.\n'
                    'Desea continuar?',
                    title='Peligro',
                    font=('Helvetica', 9, 'bold'),
                    button_color=('#000000', '#ff1919'))
                if continuar == 'Yes':
                    sys.exit()
                else:
                    pass
            else:
                break
    # convertir valores string a numericos para facilitar el procesamiento luego
    values['__cantsustantivos__'] = int(values['__cantsustantivos__'])
    values['__cantverbos__'] = int(values['__cantverbos__'])
    values['__cantadjetivos__'] = int(values['__cantadjetivos__'])

    if (values['__cantverbos__'] != 0) or (values['__cantadjetivos__'] !=
                                           0) or (values['__cantsustantivos__']
                                                  != 0):
        if values['__ayuda__'] == 'Si':  #en caso de que se seleccione ayuda,
            event_ayuda, values_ayuda = window_selectAyuda.Read()
            if event_ayuda is 'Aceptar':
                values['__ayudalistaPalabras__'] = values_ayuda[
                    '__ayudalistaPalabras__']
                values['__ayudaDefinicion__'] = values_ayuda[
                    '__ayudaDefinicion__']
            else:  #Si apreta X en la ventana de ayudas
                values['__ayuda__'] = 'No'
        #generar colores random si no se ingresan
        if values['__verbColorChooser__'] == '' or values[
                '__verbColorChooser__'] == 'None':  #Generar colores al azar si no son ingresados
            values['__verbColorChooser__'] = '#' + "%06x" % random.randint(
                0, 0xFFFFFF)
        if values['__adjColorChooser__'] == '' or values[
                '__adjColorChooser__'] == 'None':
            values['__adjColorChooser__'] = '#' + "%06x" % random.randint(
                0, 0xFFFFFF)
        if values['__sustColorChooser__'] == '' or values[
                '__sustColorChooser__'] == 'None':
            values['__sustColorChooser__'] = '#' + "%06x" % random.randint(
                0, 0xFFFFFF)

        #comprobar que la cantidad pedida de cada tipo no sobrepase la cantidad ingresada
        if values['__cantsustantivos__'] > len(
                dic_palabras['__sustantivos__']):
            values['__cantsustantivos__'] = len(
                dic_palabras['__sustantivos__'])
        if values['__cantverbos__'] > len(dic_palabras['__verbos__']):
            values['__cantverbos__'] = len(dic_palabras['__verbos__'])
        if values['__cantadjetivos__'] > len(dic_palabras['__adjetivos__']):
            values['__cantadjetivos__'] = len(dic_palabras['__adjetivos__'])

        # determino color de look and feel.
        if oficinas_temp[values['__oficinas__']] < 10:
            sg.ChangeLookAndFeel('BlueMono')
        elif (oficinas_temp[values['__oficinas__']] >=
              10) and (oficinas_temp[values['__oficinas__']] <= 25):
            sg.ChangeLookAndFeel('Purple')
        else:
            sg.ChangeLookAndFeel('Reds')

        # elimino los valores devueltos por el layout que no me sirven
        valoresInservibles = [
            '__input__', '__verbos__', '__adjetivos__', '__sustantivos__'
        ]
        for dato in valoresInservibles:
            if dato in values.keys():
                del values[dato]
    ventana_IngVen.Close()
    window_selectAyuda.Close()
    # print(values)
    return values
settings_screen = [[P_sg.Text('Settings:')],
                   [
                       P_sg.InputText('Name_Player', key='_NAME_'),
                       P_sg.Text('Name', size=(5, 1))
                   ],
                   [
                       P_sg.InputText('ID_Player', key='_ID_Name_'),
                       P_sg.Text('ID', size=(3, 1))
                   ],
                   [
                       P_sg.Button('Add', key='ADD__ID', size=(10, 1)),
                       P_sg.Text('Add profile to the LIST:')
                   ],
                   [
                       P_sg.InputOptionMenu(list_id,
                                            size=(49, 1),
                                            key='COMBO_LIST')
                   ],
                   [
                       P_sg.Button('Del Profile', key='DEL__ID', size=(10, 1)),
                       P_sg.Button('Save Profile',
                                   key='Save_Settings',
                                   button_color=('white', 'green'),
                                   size=(10, 1)),
                       P_sg.Button('Cancel',
                                   key='Cancel',
                                   button_color=('white', 'firebrick3'),
                                   size=(10, 1))
                   ],
                   [
                       P_sg.T(version_project(),
Exemple #17
0

    with open("stop_key.txt", "w+") as save_stop_key:
        save_stop_key.write(stop_key.upper()) # Save stop key in txt file
        save_stop_key.close()


    pop.write_event_value(event2, None)
    pop.close()


# Frame layout
frame = [   [sg.Text("Click Interval (milliseconds):", font=("Arial", 13), pad=((0, 70), None)), sg.Text("Repeat x Times:", font=("Arial", 13), pad=((0, 45), None))],
            [sg.Input(size=(24, 1), justification="c", default_text=100, tooltip="e.g: 0, 50, 100, 500, 1000...", key="-I1-", font=30), sg.Input(size=(24, 1), justification="c", default_text=1000, key="-I2-", font=30)],
            [sg.Checkbox(("Allwais On Top"), pad=((20, 100), 2), key="-ONTOP-"), sg.Checkbox('Click until stoped', key="-CB-")],
            [sg.InputOptionMenu(('Left Click', 'Right Click'), default_value="Left Click", key="-BIOM-", pad=((15, 100), 2)), sg.InputOptionMenu(("Single Click", "Double Click"), default_value="Single Click", key="-CTIOM-")],
            [sg.Text("—" * 1000)],
            [sg.Button(f"Start ({start_key})", font=("Arial", 15), pad=(5, (0, 0)), key="-STAB-"), sg.Button(f"Stop ({stop_key})", font=("Arial", 15), pad=(5, (0, 0)), key="-STOB-")],
            [sg.Button("Settings", font=("Arial", 12), pad=(None, (10, 0)), size=(13, 0))]]


# Put layout inside a frame is just to add a super small margin that i whanted to add
layout = [  [sg.Text("Flame Auto Clicker", justification='c', size=(100, 1), pad=(None, (10, 0)) , font=("Arial", 25))],
            [sg.Text("—" * 1000)],
            [sg.Frame(None, frame, element_justification='c', border_width=0)]]



# Window Config
window = sg.Window('Flame Auto Clicker', layout, size=(505, 293), alpha_channel=opacity, finalize=True, icon="ico.ico", keep_on_top=False, element_justification="c", margins=(0, 0))
Exemple #18
0
             justification='center',
             font=("Helvetica", 10),
             relief=sg.RELIEF_RIDGE),
 ],
 [
     sg.InputText(('Masukkan Judul Besar'), size=(DefaultWidth, 2)),
     sg.T(' '),
     sg.T(' '),
     sg.Text('Logo yang biasa digunakan', size=(DefaultWidth, 1)),
     sg.T(' '),
     sg.T(' '),
     sg.Text('Pilih Background sesuai kategori', size=(DefaultWidth, 1)),
 ],
 [
     sg.InputOptionMenu(
         ('-- Pilih Font --', 'Archivo Black', 'Comfortaa', 'Great Vibes',
          'Indie Flower', 'Kaushan Script', 'Love Ya', 'Marck Script',
          'Muli', 'Saira Stencil One')),
     sg.T('   '),
     sg.T(' '),
     sg.T(' '),
     sg.T(' '),
     sg.T(' '),
     sg.T(' '),
     sg.T(' '),
     sg.T(' '),
     sg.T(' '),
     sg.Checkbox('Logo AiDesign',
                 size=(DefaultWidth, 1),
                 default=True,
                 disabled=True),
     sg.T(' '),
Exemple #19
0
        ],
        [sg.Text('_' * split_line_size)],

        # ---------------------- Setup ---------------------- #
        [sg.Text('Setup Arguments', size=(35, 1))],
        [  # Input setting
            sg.Frame('Set Start Time and Duration', [[
                sg.Column(column_st),
                sg.Column(column_dur),
            ]]),
            # Output setting
            sg.Frame('Resolution FPS and FileName',
                     [[
                         sg.Text('Width:', justification='left'),
                         sg.InputOptionMenu(
                             ('240', '320', '480', '640', '800'),
                             default_value='320',
                             key='-Resolution-'),
                         sg.Text('Frames: 50',
                                 size=(10, 1),
                                 justification='left',
                                 key='-Frames-')
                     ],
                      [
                          sg.Slider(range=(5, 60),
                                    default_value=10,
                                    orientation='h',
                                    size=(25, 20),
                                    enable_events=True,
                                    key='-FPS-Slider-')
                      ],
                      [
def runfunctions(nextgui, option, option1, df):
    #////////////////////////////////////////////////////////////////////
    #THIS IS THE TEAM HALF
    #////////////////////////////////////////////////////////////////////
    #putting some inital values before letting users pick an option.
    if option1 == 'InputT':
        #Runs the window from above called
        window = sg.Window('Team Input').Layout(TI)
        stay, names = window.Read()
        nextgui = stay[0]
        print(nextgui)
        print(names)
        #tname = team name
        #pname = player name
        tname = names[0]
        pname1 = names[1]
        pname2 = names[2]
        pname3 = names[3]
        pname4 = names[4]
        pname5 = names[5]
        if tname == "":
            print("hoh")
        else:
            print(pname1)
            print(pname2)
            print(pname3)
            print(pname4)
            print(pname5)
            print(tname)
            #translates new team into a dataframe
            df2 = pd.DataFrame({
                "team": [tname],
                "score": [0],
                "player1": [pname1],
                "player2": [pname2],
                "player3": [pname3],
                "player4": [pname4],
                "player5": [pname5],
            })
            print(df2)
            #adds the new team's dataframe into the main dataframe
            df2.to_csv('team.txt', mode='a', header=False, index=False)
            print(df)
            #ADD PANDA CODE FOR EDITING HERE
        window.Close()
    elif option1 == 'Results InputT':
        df_copy = pd.concat([
            df['team'], df['score'], df['player1'], df['player2'],
            df['player3'], df['player4'], df['player5'], df['eventID'],
            df['position']
        ],
                            axis=1,
                            keys=[
                                'team', 'score', 'player1', 'player2',
                                'player3', 'player4', 'player5', 'eventID',
                                'position'
                            ])
        print(df_copy)
        #Sorts
        df_copy.sort_values(['score'], ascending=[False], inplace=True)
        print(df_copy)
        df_copy.drop_duplicates(subset="team", keep='first', inplace=True)
        print(df_copy)
        try:
            tn1 = df_copy.iloc[0, 0]
            print(tn1)
        except:
            tn1 = "NaN"
            print("could not print tn1")
        try:
            tn2 = df_copy.iloc[1, 0]
            print(tn2)
        except:
            tn2 = "NaN"
            print("could not print tn2")
        try:
            tn3 = df_copy.iloc[2, 0]
            print(tn3)
        except:
            tn3 = "NaN"
            print("could not print tn3")
        try:
            tn4 = df_copy.iloc[3, 0]
            print(tn4)
        except:
            tn4 = "NaN"
            print("could not print tn4")
        try:
            tn5 = df_copy.iloc[4, 0]
            print(tn5)
        except:
            tn5 = "NaN"
            print("could not print tn5")

        GRIT = [[sg.Text('Please enter the game played')],
                [
                    sg.InputOptionMenu(
                        ('5 a side football', '400m relay', 'Team quiz',
                         'Escape room', 'Tower Challenge'))
                ], [sg.Text('Please enter the rankings of team:' + tn1)],
                [sg.InputOptionMenu(('1', '2', '3', '4', '5'))],
                [sg.Text('Please enter the rankings of team:' + tn2)],
                [sg.InputOptionMenu(('1', '2', '3', '4', '5'))],
                [sg.Text('Please enter the rankings of team:' + tn3)],
                [sg.InputOptionMenu(('1', '2', '3', '4', '5'))],
                [sg.Text('Please enter the rankings of team:' + tn4)],
                [sg.InputOptionMenu(('1', '2', '3', '4', '5'))],
                [sg.Text('Please enter the rankings of team:' + tn5)],
                [sg.InputOptionMenu(('1', '2', '3', '4', '5'))],
                [sg.Submit('Return')]]
        window = sg.Window('Results Inputter').Layout(GRIT)
        stay = window.Read()
        window.Close()
    #This is used to see overall rankings.
    elif option1 == 'Results SheetT':
        df.copy(deep=True)
        #Makes copy of dataframe
        df_copy = pd.concat([
            df['team'], df['score'], df['player1'], df['player2'],
            df['player3'], df['player4'], df['player5'], df['eventID'],
            df['position']
        ],
                            axis=1,
                            keys=[
                                'team', 'score', 'player1', 'player2',
                                'player3', 'player4', 'player5', 'eventID',
                                'position'
                            ])
        print(df_copy)
        #Sorts
        df_copy.sort_values(['score'], ascending=[False], inplace=True)
        print(df_copy)
        df_copy.drop_duplicates(subset="team", keep='first', inplace=True)
        print(df_copy)
        try:
            tn1 = df_copy.iloc[0, 0]
            print(tn1)
        except:
            tn1 = "NaN"
            print("could not print tn1")
        try:
            tn2 = df_copy.iloc[1, 0]
            print(tn2)
        except:
            tn2 = "NaN"
            print("could not print tn2")
        try:
            tn3 = df_copy.iloc[2, 0]
            print(tn3)
        except:
            tn3 = "NaN"
            print("could not print tn3")
        try:
            tn4 = df_copy.iloc[3, 0]
            print(tn4)
        except:
            tn4 = "NaN"
            print("could not print tn4")
        try:
            tn5 = df_copy.iloc[4, 0]
            print(tn5)
        except:
            tn5 = "NaN"
            print("could not print tn5")
        #GUI LAYOUT FOR RESULTS SHEET
        TRS = [[sg.Text('This is the current Leaderboard:')],
               [sg.Text('Rank 1: ' + tn1)], [sg.Text('Rank 2: ' + tn2)],
               [sg.Text('Rank 3: ' + tn3)], [sg.Text('Rank 4: ' + tn4)],
               [sg.Text('Rank 5: ' + tn5)], [sg.Submit('Return')]]
        window = sg.Window('Results Sheet').Layout(TRS)
        stay = window.Read()
        window.Close()
    elif option1 == 'LookerT':
        #Runs the window from above called
        window = sg.Window('Team Looker').Layout(TF)
        stay, lookingfor = window.Read()
        window.Close()
        lookingfor = lookingfor[0]
        tname = str(lookingfor)
        #making a mini set of data out of the main datbase to serve the purpose of finding the team and players.
        df2 = pd.concat([
            df['team'], df['player1'], df['player2'], df['player3'],
            df['player4'], df['player5']
        ],
                        axis=1,
                        keys=[
                            'team', 'player1', 'player2', 'player3', 'player4',
                            'player5'
                        ])
        #making another mini set of data out of the main datbase to serve the purpose of finding the team and their positioning in events.
        df3 = pd.concat([df['team'], df['eventID'], df['position']],
                        axis=1,
                        keys=['team', 'eventID', 'position'])
        #used to search in the mini set of data for the specific team.
        locate = df2.loc[df2['team'] == tname]
        #used again to search in the other mini set of data for the specific team.
        locate2 = df3.loc[df3['team'] == tname]
        #sorting the data by the event.
        locate2.sort_values(['eventID'], ascending=[True], inplace=True)
        print(locate2)
        #trying to locate the player names
        try:
            pn1 = locate.iloc[0, 1]
        except:
            pn1 = ''
        try:
            pn2 = locate.iloc[0, 2]
        except:
            pn2 = ''
        try:
            pn3 = locate.iloc[0, 3]
        except:
            pn3 = ''
        try:
            pn4 = locate.iloc[0, 4]
        except:
            pn4 = ''
        try:
            pn5 = locate.iloc[0, 5]
        except:
            pn5 = ''
        #making sure player names if they weer just numbers are turned into strings
        pn1 = str(pn1)
        pn2 = str(pn2)
        pn3 = str(pn3)
        pn4 = str(pn4)
        pn5 = str(pn5)
        #tryig to lcoate the events.
        try:
            en1 = locate2.iloc[0, 2]
        except:
            en1 = ''
        try:
            en2 = locate2.iloc[1, 2]
        except:
            en2 = ''
        try:
            en3 = locate2.iloc[2, 2]
        except:
            en3 = ''
        try:
            en4 = locate2.iloc[3, 2]
        except:
            en4 = ''
        try:
            en5 = locate2.iloc[4, 2]
        except:
            en5 = ''
        #turns event scores into a string as pandas automatically makes it an interger.
        en1 = str(en1)
        en2 = str(en2)
        en3 = str(en3)
        en4 = str(en4)
        en5 = str(en5)

        if pn1 == "":
            #worked indicates if the team was found or not.
            worked = '0'
        else:
            worked = '1'
        if worked == '1':
            #GUI LAYOUT FOR FOUND TEAM
            TFO = [[sg.Text('We found: ' + tname)],
                   [sg.Text('player 1: ' + pn1)
                    ], [sg.Text('player 2: ' + pn2)],
                   [sg.Text('player 3: ' + pn3)],
                   [sg.Text('player 4: ' + pn4)],
                   [sg.Text('player 5: ' + pn5)], [sg.Submit('Next')]]
            #opens to tell user that it had found the team and tell them the players in the team
            window = sg.Window('Team Found').Layout(TFO)
            stay = window.Read()
            window.Close()
            #GUI LAYOUT FOR FOUND TEAM EVENTS PLACEMENT
            TFO2 = [[sg.Text('Positioning of: ' + tname)],
                    [sg.Text('Football: ' + en1)],
                    [sg.Text('Escape Room: ' + en2)],
                    [sg.Text('400m Relay: ' + en3)],
                    [sg.Text('Team Quiz: ' + en4)],
                    [sg.Text('Tower Challenge: ' + en5)], [sg.Submit('Next')]]
            #opens to tell user about their rankings in the events they have attended.
            window = sg.Window('Team Found').Layout(TFO2)
            stay = window.Read()
            window.Close()
        else:
            #Runs a window to tell the user that the team was not found.
            window = sg.Window('There has been an issue').Layout(IV)
            window.Read()
            window.Close()
    else:
        runsubmenu(nextgui, option)


#////////////////////////////////////////////////////////////////////
#THIS IS THE INDIVIDUAL HALF
#////////////////////////////////////////////////////////////////////
#putting some inital values before letting users pick an option.
    if option1 == 'InputI':
        #Runs the window from above called
        window = sg.Window('Individual Input').Layout(II)
        stay, names = window.Read()
        nextgui = stay[0]
        print(nextgui)
        print(names)
        #iname = individual name
        iname = names[0]
        if iname == "":
            print("hoh")
        else:
            print(iname)
            #translates new player into a dataframe
            df2 = pd.DataFrame({
                "individual": [iname],
                "score": [0],
            })
            print(df2)
            #adds the new player's dataframe into the main dataframe
            df2.to_csv('individual.txt', mode='a', header=False, index=False)
            print(df)
        window.Close()

    elif option1 == 'Results InputI':
        df_copy = pd.concat(
            [df['individual'], df['score'], df['eventID'], df['position']],
            axis=1,
            keys=['individual', 'score', 'eventID', 'position'])
        print(df_copy)
        #Sorts
        df_copy.sort_values(['score'], ascending=[False], inplace=True)
        print(df_copy)
        df_copy.drop_duplicates(subset="individual",
                                keep='first',
                                inplace=True)
        print(df_copy)
        try:
            pn1 = df_copy.iloc[0, 0]
            pn1 = str(pn1)
            print(pn1)
        except:
            pn1 = "NaN"
            print("could not print tn1")
        try:
            pn2 = df_copy.iloc[1, 0]
            pn2 = str(pn2)
            print(pn2)
        except:
            pn2 = "NaN"
            print("could not print tn2")
        try:
            pn3 = df_copy.iloc[2, 0]
            pn3 = str(pn3)
            print(pn3)
        except:
            pn3 = "NaN"
            print("could not print tn3")
        try:
            pn4 = df_copy.iloc[3, 0]
            pn4 = str(pn4)
            print(pn4)
        except:
            pn4 = "NaN"
            print("could not print tn4")
        try:
            pn5 = df_copy.iloc[4, 0]
            pn5 = str(pn5)
            print(pn5)
        except:
            pn5 = "NaN"
            print("could not print tn5")
        try:
            pn6 = df_copy.iloc[5, 0]
            pn6 = str(pn6)
            print(pn6)
        except:
            pn6 = "NaN"
            print("could not print tn5")
        try:
            pn7 = df_copy.iloc[7, 0]
            pn7 = str(pn7)
            print(pn7)
        except:
            pn7 = "NaN"
            print("could not print tn5")
        try:
            pn8 = df_copy.iloc[8, 0]
            pn8 = str(pn8)
            print(pn8)
        except:
            pn8 = "NaN"
            print("could not print tn5")
        try:
            pn9 = df_copy.iloc[9, 0]
            pn9 = str(pn9)
            print(pn9)
        except:
            pn9 = "NaN"
            print("could not print tn5")
        try:
            pn10 = df_copy.iloc[10, 0]
            pn10 = str(pn10)
            print(pn10)
        except:
            pn10 = "NaN"
            print("could not print tn5")
        try:
            pn11 = df_copy.iloc[11, 0]
            pn11 = str(pn11)
            print(pn11)
        except:
            pn11 = "NaN"
            print("could not print tn5")
        try:
            pn12 = df_copy.iloc[12, 0]
            pn12 = str(pn12)
            print(pn12)
        except:
            pn12 = "NaN"
            print("could not print tn5")
        try:
            pn13 = df_copy.iloc[13, 0]
            pn13 = str(pn13)
            print(pn13)
        except:
            pn13 = "NaN"
            print("could not print tn5")
        try:
            pn14 = df_copy.iloc[10, 0]
            pn14 = str(pn14)
            print(pn14)
        except:
            pn14 = "NaN"
            print("could not print tn5")
        try:
            pn15 = df_copy.iloc[10, 0]
            pn15 = str(pn15)
            print(pn15)
        except:
            pn15 = "NaN"
            print("could not print tn5")
        try:
            pn16 = df_copy.iloc[16, 0]
            pn16 = str(pn16)
            print(pn16)
        except:
            pn16 = "NaN"
            print("could not print tn5")
        try:
            pn17 = df_copy.iloc[17, 0]
            pn17 = str(pn17)
            print(pn17)
        except:
            pn17 = "NaN"
            print("could not print tn5")
        try:
            pn18 = df_copy.iloc[18, 0]
            pn18 = str(pn18)
            print(pn18)
        except:
            pn18 = "NaN"
            print("could not print tn5")
        try:
            pn19 = df_copy.iloc[19, 0]
            pn19 = str(pn19)
            print(pn19)
        except:
            pn19 = "NaN"
            print("could not print tn5")
        try:
            pn20 = df_copy.iloc[20, 0]
            pn20 = str(pn20)
            print(pn20)
        except:
            pn20 = "NaN"
            print("could not print tn5")
        GRII = [
            [sg.Text('Please enter the game played')],
            [
                sg.InputOptionMenu(
                    ('Basketball hoop challenge', '100m run', 'Quiz',
                     'Timed assault course', 'Tower Challenge'))
            ], [sg.Text('Please enter the rankings of player:' + pn1)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn2)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn3)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn4)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn5)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn6)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn7)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn8)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn9)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn10)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Submit('Return')]
        ]
        GRII2 = [
            [sg.Text('Part 2')],
            [sg.Text('Please enter the rankings of player:' + pn11)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn12)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn13)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn14)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn15)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn16)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn17)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn18)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn19)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Text('Please enter the rankings of player:' + pn20)],
            [
                sg.InputOptionMenu(
                    ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
                     '12', '13', '14', '15', '16', '17', '18', '19', '20'))
            ], [sg.Submit('Return')]
        ]
        window = sg.Window('Results Inputter').Layout(GRII)
        stay, option = window.Read()
        print(option)
        print(stay)
        window.Close()
        window = sg.Window('Results Inputter').Layout(GRII2)
        stay, option = window.Read()
        print(option)
        print(stay)
        window.Close()
    #This is used to see overall rankings.
    elif option1 == 'Results SheetI':
        df.copy(deep=True)
        #Makes copy of dataframe
        df_copy = pd.concat(
            [df['individual'], df['score'], df['eventID'], df['position']],
            axis=1,
            keys=['individual', 'score', 'eventID', 'position'])
        print(df_copy)
        #Sorts
        df_copy.sort_values(['score'], ascending=[False], inplace=True)
        print(df_copy)
        df_copy.drop_duplicates(subset="individual",
                                keep='first',
                                inplace=True)
        print(df_copy)
        try:
            tn1 = df_copy.iloc[0, 0]
            print(pn1)
        except:
            tn1 = "NaN"
            print("could not print pn1")
        try:
            tn2 = df_copy.iloc[1, 0]
            print(tn2)
        except:
            tn2 = "NaN"
            print("could not print tn2")
        try:
            tn3 = df_copy.iloc[2, 0]
            print(tn3)
        except:
            tn3 = "NaN"
            print("could not print tn3")
        try:
            tn4 = df_copy.iloc[3, 0]
            print(tn4)
        except:
            tn4 = "NaN"
            print("could not print tn4")
        try:
            tn5 = df_copy.iloc[4, 0]
            print(tn5)
        except:
            tn5 = "NaN"
            print("could not print tn5")
        #GUI LAYOUT FOR RESULTS SHEET
        TRS = [[sg.Text('This is the current Leaderboard:')],
               [sg.Text('Rank 1: ' + tn1)], [sg.Text('Rank 2: ' + tn2)],
               [sg.Text('Rank 3: ' + tn3)], [sg.Text('Rank 4: ' + tn4)],
               [sg.Text('Rank 5: ' + tn5)], [sg.Submit('Return')]]
        window = sg.Window('Results Sheet').Layout(TRS)
        stay = window.Read()
        window.Close()
    elif option1 == 'LookerI':
        #Runs the window from above called
        window = sg.Window('Player Looker').Layout(IF)
        stay, lookingfor = window.Read()
        window.Close()
        lookingfor = lookingfor[0]
        tname = str(lookingfor)
        #making a mini set of data out of the main datbase to serve the purpose of finding the team and players.
        df2 = pd.concat(
            [df['individual'], df['score'], df['eventID'], df['position']],
            axis=1,
            keys=['individual', 'score', 'eventID', 'position'])
        #making another mini set of data out of the main datbase to serve the purpose of finding the team and their positioning in events.
        df3 = pd.concat(
            [df['individual'], df['score'], df['eventID'], df['position']],
            axis=1,
            keys=['individual', 'score', 'eventID', 'position'])
        #used to search in the mini set of data for the specific team.
        locate = df2.loc[df2['individual'] == tname]
        #used again to search in the other mini set of data for the specific team.
        locate2 = df3.loc[df3['individual'] == tname]
        #sorting the data by the event.
        locate2.sort_values(['eventID'], ascending=[True], inplace=True)
        print(locate2)
        #trying to locate the player names
        try:
            in1 = locate.iloc[0, 0]
            in1 = str(in1)
        except:
            in1 = 'NaN'
            print('NaN')
        #making sure player names if they weer just numbers are turned into strings
        #tryig to lcoate the events.
        try:
            en1 = locate2.iloc[0, 2]
        except:
            en1 = ''
        try:
            en2 = locate2.iloc[1, 2]
        except:
            en2 = ''
        try:
            en3 = locate2.iloc[2, 2]
        except:
            en3 = ''
        try:
            en4 = locate2.iloc[3, 2]
        except:
            en4 = ''
        try:
            en5 = locate2.iloc[4, 2]
        except:
            en5 = ''
        #turns event scores into a string as pandas automatically makes it an interger.
        en1 = str(en1)
        en2 = str(en2)
        en3 = str(en3)
        en4 = str(en4)
        en5 = str(en5)

        if in1 == "":
            #worked indicates if the player was found or not.
            worked = '0'
        else:
            worked = '1'
        if worked == '1':
            #GUI LAYOUT FOR FOUND TEAM
            PFO = [[sg.Text('We found: ' + in1)], [sg.Submit('Next')]]
            #opens to tell user that it had found the team and tell them the players in the team
            window = sg.Window('Player Found').Layout(PFO)
            stay = window.Read()
            window.Close()
            #GUI LAYOUT FOR FOUND TEAM EVENTS PLACEMENT
            PFO2 = [[sg.Text('Positioning of: ' + in1)],
                    [sg.Text('Basketball hoop challenge: ' + en1)],
                    [sg.Text('100m Run: ' + en2)],
                    [sg.Text('Individual quiz: ' + en3)],
                    [sg.Text('Timed assault course: ' + en4)],
                    [sg.Text('Tower Challenge: ' + en5)], [sg.Submit('Next')]]
            #opens to tell user about their rankings in the events they have attended.
            window = sg.Window('Player Found').Layout(PFO2)
            stay = window.Read()
            window.Close()
        else:
            #Runs a window to tell the user that the team was not found.
            window = sg.Window('There has been an issue').Layout(IV)
            window.Read()
            window.Close()
    else:
        runsubmenu(nextgui, option)
Exemple #21
0
if __name__ == '__main__':

    sg.theme('DarkAmber')  # Add a touch of color
    # All the stuff inside your window.
    layout = [[
        sg.Text('File', size=(12, 1)),
        sg.Button('Read input file'),
        sg.Button('Save input')
    ],
              [
                  sg.Text('Right hand side',
                          size=(12, 1),
                          auto_size_text=False,
                          justification='left'),
                  sg.InputOptionMenu(('Constant', 'Linear', 'Quadratic'),
                                     key='Right hand side',
                                     default_value='Constant',
                                     size=(7, 1)),
                  sg.Text('Ax^2+By^2+Cx*y+Dx+Ey+F',
                          size=(20, 1),
                          auto_size_text=True,
                          justification='left')
              ],
              [
                  sg.Text('Domain',
                          size=(12, 1),
                          auto_size_text=False,
                          justification='left'),
                  sg.InputText("[0,1] x [0,1]", key='Domain', size=(12, 1)),
                  sg.InputText("1", key='rhs_coeff', size=(20, 1))
              ],
              [
Exemple #22
0
 def CreateLayout(self):
     font = 'Helvetica'
     self.layout = [[sg.Text('Nonverbal Toolkit', font=(font, 16), justification='center')],
                    [sg.Text('What would you like to do?', font=(font, 16), justification='center')],
                    [sg.InputOptionMenu(('Run Experiments', 'Free Record', 'Data Analysis'))],
                    [sg.Submit(), sg.Cancel()]]
Exemple #23
0
from more_itertools import grouper
import itertools
sg.SetOptions(element_padding=(0, 0))


"""
    Restrict the characters allowed in an input element to digits and . or -
    Accomplished by removing last character input if not a valid character
"""

layout = [  [sg.Text('Input value for you would like to convert, please input only numbers')],
            [sg.Input(key='-IN-', enable_events=True, size=(10,1))],

            [sg.Text('Convert From',pad=(30,10)), sg.Text('Convert to')],

            [sg.InputOptionMenu(["Binary","Base 10", "hexadecimal","Octal"],pad=(10,5), key='-from-',size=(15,5)), sg.InputOptionMenu(["Binary","Base 10", "hexadecimal","Octal"],key='-to-',size=(15,30))],
            
            [sg.Button('Submit'),sg.Button('Exit')]  
            
            ]

window = sg.Window('Bucky', layout)


    
def bintobase10():

     user_input = values["-IN-"]

     user_input_string = str(user_input)
Exemple #24
0
def FORMS(back_colour):
    #---------------------------------------------------- OPENING ----------------------------------------------------#
    global OPENING
    OPENING = [
        [sg.Text('Select House', size=(12, 1), font=('Courier New', 16))],
        [
            sg.InputOptionMenu(
                ('Petronax', 'Mauris', 'Scholastica', 'Hildegard'),
                size=(17, 1),
                key='House')
        ],
        [sg.ReadFormButton('Select', size=(15, 1), font=('Courier New', 12))]
    ]

    #----------------------------------------------------- START -----------------------------------------------------#
    global START
    START = [
        [
            sg.Text('Select Sport',
                    size=(12, 1),
                    font=('Courier New', 16),
                    background_color=back_colour)
        ],
        [sg.ReadFormButton('Running', size=(20, 1), font=('Courier New', 10))],
        [
            sg.ReadFormButton('Swimming',
                              size=(20, 1),
                              font=('Courier New', 10))
        ],
        [
            sg.ReadFormButton('Weightlifting',
                              size=(20, 1),
                              font=('Courier New', 10))
        ],
        [sg.ReadFormButton('Shotput', size=(20, 1), font=('Courier New', 10))],
        [sg.ReadFormButton('Discus', size=(20, 1), font=('Courier New', 10))],
        [sg.ReadFormButton('Archery', size=(20, 1), font=('Courier New', 10))],
        [sg.ReadFormButton('Records', size=(20, 1), font=('Courier New', 10))],
        [sg.ReadFormButton('Close', size=(20, 1), font=('Courier New', 10))]
    ]

    #---------------------------------------------------- RUNNING ----------------------------------------------------#
    global RUNNING
    RUNNING = [[
        sg.Text('Running',
                size=(12, 1),
                font=('Courier New', 16),
                background_color=back_colour)
    ], [
        sg.ReadFormButton('Stopwatch', size=(20, 1), font=('Courier New', 10))
    ],
               [
                   sg.ReadFormButton('Speed Calculator',
                                     size=(20, 1),
                                     font=('Courier New', 10))
               ],
               [
                   sg.ReadFormButton('Back',
                                     size=(20, 1),
                                     font=('Courier New', 10))
               ]]

    global START_BUTTON
    START_BUTTON = sg.ReadFormButton('Start',
                                     size=(32, 1),
                                     font=('Courier New', 10))
    global RESET_BUTTON
    RESET_BUTTON = sg.ReadFormButton('Reset',
                                     size=(32, 1),
                                     font=('Courier New', 10))
    global OVERALL_TIMER
    OVERALL_TIMER = sg.Text('0:00:00.000',
                            size=(11, 1),
                            font=('Courier New', 16),
                            background_color=back_colour)
    global LAPPED_TIMER
    LAPPED_TIMER = sg.Text('0:00:00.000',
                           size=(11, 1),
                           font=('Courier New', 16),
                           background_color=back_colour)
    global STOPWATCH
    STOPWATCH = [[
        sg.Text('Stopwatch',
                size=(12, 1),
                font=('Courier New', 16),
                background_color=back_colour)
    ],
                 [
                     sg.Text('Overall:',
                             size=(8, 1),
                             font=('Courier New', 16),
                             background_color=back_colour), OVERALL_TIMER
                 ],
                 [
                     sg.Text('Lapped:',
                             size=(8, 1),
                             font=('Courier New', 16),
                             background_color=back_colour), LAPPED_TIMER
                 ], [START_BUTTON], [RESET_BUTTON],
                 [
                     sg.ReadFormButton('Back',
                                       size=(32, 1),
                                       font=('Courier New', 10))
                 ]]

    global CALCULATOR_SPEED
    CALCULATOR_SPEED = sg.Text('0 km/h',
                               size=(16, 1),
                               font=('Courier New', 16),
                               background_color=back_colour)
    global RUNNING_CALCULATOR
    RUNNING_CALCULATOR = [[
        sg.Text('Speed Calculator',
                size=(20, 1),
                font=('Courier New', 16),
                background_color=back_colour)
    ],
                          [
                              sg.Text('Distance:',
                                      size=(9, 1),
                                      font=('Courier New', 16),
                                      background_color=back_colour),
                              sg.InputText(size=(15, 1),
                                           key='Running Distance'),
                              sg.InputOptionMenu(('Kilometres', 'Metres'),
                                                 size=(10, 1),
                                                 key='Running Distance Unit')
                          ],
                          [
                              sg.Text('Time:',
                                      size=(9, 1),
                                      font=('Courier New', 16),
                                      background_color=back_colour),
                              sg.InputText(size=(15, 1), key='Running Time'),
                              sg.InputOptionMenu(
                                  ('Hours', 'Minutes', 'Seconds'),
                                  size=(10, 1),
                                  key='Running Time Unit')
                          ],
                          [
                              sg.Text('Speed:',
                                      size=(9, 1),
                                      font=('Courier New', 16),
                                      background_color=back_colour),
                              CALCULATOR_SPEED
                          ],
                          [
                              sg.ReadFormButton('Submit',
                                                size=(21, 1),
                                                font=('Courier New', 10)),
                              sg.ReadFormButton('Back',
                                                size=(21, 1),
                                                font=('Courier New', 10))
                          ]]

    #--------------------------------------------------- SWIMMING  ---------------------------------------------------#
    global SWIMMING
    SWIMMING = []

    #------------------------------------------------- WEIGHTLIFTING -------------------------------------------------#
    global WEIGHTLIFTING
    WEIGHTLIFTING = []

    #---------------------------------------------------- SHOTPUT ----------------------------------------------------#
    global SHOTPUT
    SHOTPUT = []

    #---------------------------------------------------- DISCUS  ----------------------------------------------------#
    global DISCUS
    DISCUS = []

    #---------------------------------------------------- ARCHERY ----------------------------------------------------#
    global ARCHERY
    ARCHERY = []

    #---------------------------------------------------- RECORDS ----------------------------------------------------#
    global RECORDS
    RECORDS = [
        [
            sg.Text('Records',
                    size=(12, 1),
                    font=('Courier New', 16),
                    background_color=back_colour)
        ],
        [sg.ReadFormButton('Running', size=(20, 1), font=('Courier New', 10))],
        [
            sg.ReadFormButton('Swimming',
                              size=(20, 1),
                              font=('Courier New', 10))
        ],
        [
            sg.ReadFormButton('Weightlifting',
                              size=(20, 1),
                              font=('Courier New', 10))
        ],
        [sg.ReadFormButton('Shotput', size=(20, 1), font=('Courier New', 10))],
        [sg.ReadFormButton('Discus', size=(20, 1), font=('Courier New', 10))],
        [sg.ReadFormButton('Archery', size=(20, 1), font=('Courier New', 10))],
        [sg.ReadFormButton('Back', size=(20, 1), font=('Courier New', 10))]
    ]

    global RECORDS_DATA
    RECORDS_DATA = {
        'Running': {
            'Speed': {},
            'Distance': {},
            'Time': {}
        },
        'Swimming': {},
        'Weightlifting': {},
        'Shotput': {},
        'Discus': {},
        'Archery': {}
    }

    global RUNNING_RECORDS
    RUNNING_RECORDS = []

    global SWIMMING_RECORDS
    SWIMMING_RECORDS = []

    global WEIGHTLIFTING_RECORDS
    WEIGHTLIFTING_RECORDS = []

    global SHOTPUT_RECORDS
    SHOTPUT_RECORDS = []

    global DISCUS_RECORDS
    DISCUS_RECORDS = []

    global ARCHERY_RECORDS
    ARCHERY_RECORDS = []
Exemple #25
0
import PySimpleGUI as sg
import os

sg.theme('Reddit')  # Add some color to the window

layout = [
    [sg.InputText('', size=(37, 1), key='input_value')],
    [
        sg.InputOptionMenu(
            ('Install Package', 'Install From VCS',
             'Install From Requirements', 'Install From File',
             'Install From Source', 'Make Package', 'Upgrade Package'),
            size=(32, 1),
            key='-OPTION-')
    ],
    [sg.Submit(size=(32, 1))],
]

window = sg.Window('Easy Pip', layout)
event, values = window.read()


def installPackage():
    os.system(f'start cmd /k pip install {value}')


def installFromVCS():
    os.system(f'start cmd /k python -m pip install {value}')


def installFromRequirements():
default_folder = ""

# Options
left_side_width = 50
left_side_layout = [
    # Menu
    [sg.Menu(menu_def, tearoff=True)],

    # Output Option
    [
        sg.Text("Please select what type of output file:",
                size=(left_side_width, 1))
    ],
    [
        sg.InputOptionMenu(print_options,
                           key='print_option',
                           size=((int)(left_side_width * 0.8), 1))
    ],
    [
        sg.Radio('Plain text',
                 "textRadio",
                 key="txt",
                 default=True,
                 size=(10, 1)),
        sg.Radio('HTML', "textRadio", key="html")
    ],
    [sg.Text('_' * (int)(left_side_width))],

    # Web Addresses
    [sg.Text("First page to scrape from")],
    [
               key='OKuname',
               use_ttk_buttons=True,
               border_width=0,
               size=(4, 1),
               font=[font, 9],
               visible=False,
               disabled=True,
               button_color=('black', 'orange3'),
               bind_return_key=True,
               tooltip='  Tip: Hit Enter to update username  ')
 ], [sg.Text('')],
 [
     sg.Text("Current project list:", text_color='orange', font=[font, 11]),
     sg.InputOptionMenu(listKT,
                        size=(20, 1),
                        text_color='black',
                        default_value='Select...',
                        key='currentKT')
 ],
 [
     sg.Text("Add new projects:",
             metadata=True,
             text_color='orange',
             font=[font, 11]),
     sg.InputText(key='ip1',
                  tooltip=' e.g.- Project X ',
                  do_not_clear=True,
                  background_color=ip_bgcolor,
                  border_width=0,
                  font=[font, 11],
                  enable_events=True,
Exemple #28
0
import PySimpleGUI as sg

names = ['Roberta', 'Kylie']

layout = [[sg.Listbox(names, size=(20, 4), key='_LIST_')],
          [sg.InputOptionMenu(names, size=(20, 4), key='_LIST_')]]

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

new_values = ['Bill', 'Jeff']
window.Element('_LIST_').Update(new_values)

while True:
    event, values = window.Read()
    if event is None or event == 'Exit':
        break

window.Close()
 ],
 [
     sg.Multiline(
         default_text=
         'This is the default Text should you decide not to type anything',
         size=(35, 3)),
     sg.Multiline(default_text='A second multi-line', size=(35, 3))
 ],
 [
     sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)),
     sg.Slider(range=(1, 100),
               orientation='h',
               size=(34, 20),
               default_value=85)
 ],
 [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))],
 [
     sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'),
                size=(30, 3)),
     sg.Frame('Labelled Group', [[
         sg.Slider(range=(1, 100),
                   orientation='v',
                   size=(5, 20),
                   default_value=25,
                   tick_interval=25),
         sg.Slider(range=(1, 100),
                   orientation='v',
                   size=(5, 20),
                   default_value=75),
         sg.Slider(range=(1, 100),
                   orientation='v',
Exemple #30
0
                                                   "Contact Number",
                                                   "Blood Group"),
                key='-VIEW4-',
                visible=False)
VIEW5 = sg.Text('{:20}{:20}'.format("Name", "Adress"),
                key='-VIEW5-',
                visible=False)
VIEW6 = sg.Text('{:20}{:20}{:20}{:20}'.format("Blood ID", "Donated By ID",
                                              "Given To ID", "Blood Bank"),
                key='-VIEW6-',
                visible=False)
VIEW7 = sg.Text("ID", key='-VIEW7-', visible=False)
VIEW8 = sg.Text("Define X: ", key='-VIEW8-', visible=False)

OPT1 = sg.InputOptionMenu(('Show all data', 'Specific Search'),
                          default_value='Show all data',
                          k='-OPT1-')
OPT2 = sg.InputOptionMenu(('Donor', 'Patient', 'Blood Banks', 'Blood'),
                          default_value='Donor',
                          k='-OPT2-')
OPT3 = sg.InputOptionMenu(('Find donors/patients blood type', \
                        'Find how many bags each blood bank has in stock in each blood group', \
                        'Show information about donor and the blood donated', \
                        'Find blood banks where a specific donor has donated',\
                        'See who has donated blood X times', \
                        'Find who patients donor is' ), k = '-OPT3-', visible=False)
OPT4 = sg.InputOptionMenu(('Donor', 'Patient'), k='-OPT44-', visible=False)
OPT5 = sg.InputOptionMenu(('A', 'B', 'AB', 'O', 'ALL'),
                          k='-OPT5-',
                          visible=False)
OPT6 = sg.InputOptionMenu(('Specific Donor', 'ALL'), k='-OPT6-', visible=False)