예제 #1
0
        sg.Checkbox(language_manager.get_string('division'),
                    key="division",
                    default=True)
    ]

    directoryButton = sg.FolderBrowse(
        button_text=language_manager.get_string('saveText'),
        key='saveText',
        initial_folder="./")

    # set list of buttons
    listOfButtons = [
        sg.Button(language_manager.get_string('generate'), key='generate'),
        sg.Button(language_manager.get_string('save_files'), key='save_files'),
        sg.Button(language_manager.get_string('close'), key='close'),
        sg.Help(language_manager.get_string('help'), key='help')
    ]

    # Create the Window
    window = sg.Window(language_manager.get_string('title'),
                       get_layout(language_manager),
                       auto_size_text=True)

    # Initialize generated examples to empty string
    generated_examples = ""

    # Event Loop to process "events" and get the "values" of the inputs
    while True:
        try:
            # Read events and configuration information from window
            event, configurationInformation = window.read()
예제 #2
0
import PySimpleGUI as sg

layout = [[
    sg.OK(),
    sg.Ok(),
    sg.Submit(),
    sg.Cancel(),
    sg.Yes(),
    sg.No(),
    sg.Exit(),
    sg.Quit(),
    sg.Open(),
    sg.Save(),
    sg.SaveAs(),
    sg.Help()
]]

sg.Window('Window Short', layout).read()
예제 #3
0
def main():
    validated = False

    menu_def = [['File', [
        'Load',
        'Save',
        'Exit',
    ]]]

    layout = [
        [sg.Menu(menu_def)],
        [
            sg.Text('Self Organizing Map Tool',
                    size=(30, 1),
                    font=("Helvetica", 14))
        ],
        [sg.Text('_' * 100, size=(70, 1))],
        [
            sg.Text('Workspace:',
                    size=(25, 1),
                    auto_size_text=True,
                    justification='right'),
            sg.InputText(do_not_clear=True, key="_output_dir_path_"),
            sg.FolderBrowse(target='_output_dir_path_'),
            sg.Help('?', key='_help_workspace_')
        ],
        [sg.Text('_' * 100, size=(70, 1))],
        [
            sg.Text('Data Input (CSV):',
                    size=(25, 1),
                    auto_size_text=True,
                    justification='right'),
            sg.InputText(do_not_clear=True, key="_data_input_path_"),
            sg.FileBrowse(target='_data_input_path_'),
            sg.Help('?', key='_help_data_input_')
        ],
        [
            sg.Text('Excluded Data Columns:',
                    size=(25, 1),
                    auto_size_text=True,
                    justification='right'),
            sg.InputText(do_not_clear=True, key='_data_columns_excluded_'),
            sg.Sizer(60),
            sg.Help('?', key='_help_data_cols_')
        ],
        #        #################
        #        # NOT IMPLEMENTED
        #        #[sg.Text('SOM Parameters:', size=(25, 1), auto_size_text=True, justification='right'),
        #        #    sg.InputText(do_not_clear=True, key='_som_params_path_'),
        #        #    sg.FileBrowse(target = '_som_params_path_')],
        #        #################
        [
            sg.Text('Number of Grid Columns:',
                    size=(25, 1),
                    auto_size_text=True,
                    justification='right'),
            sg.InputText(do_not_clear=True, key='_columns_')
        ],
        [
            sg.Text('Number of Grid Rows:',
                    size=(25, 1),
                    auto_size_text=True,
                    justification='right'),
            sg.InputText(do_not_clear=True, key='_rows_')
        ],
        [
            sg.Text('SOM Iterations:',
                    size=(25, 1),
                    auto_size_text=True,
                    justification='right'),
            sg.InputText(default_text='500',
                         do_not_clear=True,
                         key='_iterations_')
        ],
        [
            sg.Text('SOM Grid Type:',
                    size=(25, 1),
                    auto_size_text=True,
                    justification='right'),
            sg.InputCombo(['hex', 'square'],
                          default_value='hex',
                          key='_grid_type_')
        ],
        [
            sg.Text('Number of Clusters:',
                    size=(25, 1),
                    auto_size_text=True,
                    justification='right'),
            sg.InputText(do_not_clear=True, key='_number_clusters_'),
            sg.Sizer(60),
            sg.Help('?', tooltip="details here", key='_help_clusters_')
        ],
        [
            sg.Text('',
                    text_color=None,
                    background_color=None,
                    size=(70, 1),
                    key='_success_message_')
        ],
        [sg.Submit(), sg.Cancel(key='_cancel_')]
    ]

    window = sg.Window('SOM Selector Tool',
                       auto_size_text=True,
                       default_element_size=(40, 1)).Layout(layout)

    # Event Loop
    while True:
        event, values = window.Read()
        if event is None:
            break
        if event == '_cancel_':
            break
        if event == 'Submit':
            try:
                # TODO: Should try to validate file inputs first
                results = som_selector.execute(values)
                som_fig = results['som_figure']
                som_model_path = results['model_weights_path']
                show_figure(som_fig, som_model_path)
                #print(values)
                pass
            except:
                print("Unexpected error:", sys.exc_info()[0])
                raise
            window.FindElement('_success_message_').Update(
                text_color="#24b73d")
            window.FindElement('_success_message_').Update(
                'The Model Completed Successfully')
            window.FindElement('_cancel_').Update('Close')
        if event == 'Save':
            save_path = sg.PopupGetFile(
                'Select a file path to save window parameters.',
                default_extension='.json',
                file_types=(("JSON Files", "*.json"), ),
                no_window=True,
                save_as=True)
            if save_path != '':
                save_key_dict = {}
                for key, val in values.items():
                    if key in SETTINGS_KEYS_TO_SAVE:
                        save_key_dict[key] = val
                with open(save_path, 'w') as fp:
                    json.dump(save_key_dict, fp)
        if event == 'Load':
            load_path = sg.PopupGetFile(
                'Select the Window Parameters to Load.',
                default_extension='.json',
                file_types=(("JSON Files", "*.json"), ),
                no_window=True)
            if load_path != '':
                #window.LoadFromDisk(load_path)
                with open(load_path, 'r') as fp:
                    values = json.load(fp)
                    print(values)
                    window.Fill(values)
        if event.startswith("_help"):
            sg.popup_no_titlebar(HELP_KEYS_TO_MSG[event],
                                 background_color="#5a6366")
    print("Done.")
예제 #4
0
             size=(18, 1)), sg.In(), sg.FolderBrowse("Parcourir", size=(10, 1))],
    [sg.T("Dossier d'enregistrement:", size=(18, 1)),
     sg.InputText(), sg.FolderBrowse("Parcourir", size=(10, 1))],
    [sg.T('1e ligne du tampon:', size=(18, 2)), sg.In()],
    [sg.T('2e ligne du tampon:', size=(18, 2)), sg.In()],
    [sg.T('3e ligne du tampon:', size=(18, 2)), sg.In()],
    [sg.Frame(layout=[
        [sg.Radio('Tamponner toutes les pages', "RADIO1", default=True, size=(24, 1)),
         sg.Radio('Tamponner la page n°', "RADIO1"), sg.In(size=(3, 1))],
        [sg.Checkbox('Numéroter les tampons', size=(18, 1), default=False),
         sg.T('Police:'), sg.InputCombo((fonts), size=(18, 1)),
         sg.T('Couleur:'), sg.InputCombo((list(colors.keys())), size=(6, 1))]],
        title='Options', title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Utiliser ceci pour régler les options')],
    [sg.Submit("Tamponner"),
    sg.Cancel("Annuler"), sg.T(' ' * 76),
    sg.Help("Aide", size=(10, 1), button_color=('black', 'orange'))]
    ]

window = sg.Window('Tampon 2 PDF : tampons numériques numérotés et non numérotés', layout)

jobNo = 1

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

    if event == 'Aide':
        sg.Popup('Aide pour pdfstamper_win0.2-fr',
                 help_lisc_input, help_num, help_thanks, help_donation)
        continue
예제 #5
0
def MainGui():

    con, cur = IntroDB()
    
    layout1 = [[sg.Menu(menu_def, tearoff=True)],

    [sg.Column([
        [sg.Frame("Perfil de impresora",layout=[
            [sg.Combo(values=[element[0] for element in GetThings(cur)], readonly=True, key="-CHOSPRINTER1-",size = (33,1), change_submits=True),sg.Button("Editar",key ="-EDITPRINTER1-")]])]],vertical_alignment='center', justification='center')],
    
     [sg.Column([[Collapse([[sg.Text("Selecciona perfil de impresora válido", auto_size_text=True,text_color="red",justification="center")]],"-CHECKPRINTER1-", False)]], vertical_alignment="center",justification="center")],

        [sg.Column([[sg.Frame(title="",layout=[[sg.Text('· Tiempo de impresión', size=commonParams[0]),
        	sg.Text("(Horas:Minutos)", size=commonParams[0]),
         	sg.Input(key='-INaccess11-', size=commonParams[1], enable_events=True)],
        [sg.Text('· Material Consumido', size=commonParams[0]),
        	sg.Text("(Gramos)", size=commonParams[0]),
         	sg.Input(key='-INaccess21-', size=commonParams[1], enable_events=True)],
        [sg.Text('· Coste de laminado', size=commonParams[0]),
        	sg.Text("(Euros)", size=commonParams[0]),
         	sg.Input(key='-INaccess31-', size=commonParams[1], enable_events=True)]])]], 				vertical_alignment='center', justification='center')],
         	
        [sg.Column([[Collapse([[sg.Text("Dato mal introducido",key="-CHECKINPUTS1-",size=commonParams[3],text_color="red",justification="center")]],"-COLUMNINPUTS1-", False)]], vertical_alignment="center",justification="center")],
        [sg.Checkbox('Activar Opciones de Venta', enable_events=True,
                     key='-CHbox1-', font=commonParams[2])],
        [sg.Column([[Collapse(
            [[sg.Text("· Margen de Venta (%)", size=commonParams[0]), sg.Input(key='-INaccess41-', size=commonParams[1], enable_events=True)],
             [sg.Text("· Porcentaje de IVA (%)", size=commonParams[0]), sg.Input(key='-INaccess51-', disabled=True, 			size=commonParams[1], enable_events=True),
              sg.Help("Ayuda", tooltip="Margen de ventas debe ser 0 o superior", key="-Help1-", pad=((5, 0), (0, 0)), 			button_color=("blue"))]], '-Token1-', False)]], vertical_alignment='center', justification='center')],
        
        [sg.HorizontalSeparator(pad=((0, 0), (0, 0)))],
        [sg.Text("")],
        [sg.Column([[sg.Button("Calcular", font=commonParams[2], key="-INsubmit1-", auto_size_button=True, pad=((0, 0),(0,0))), 		     sg.Button("Reiniciar", key="-Reset1-", font=commonParams[2], pad=((20, 0), (0, 0)))]],
                     justification ="center")],
        
    ]

    layout2 = [[sg.Menu(menu_def, tearoff=True)],
    
    [sg.Column([
        [sg.Frame("Perfil de impresora",layout=[
            [sg.Combo(values=[element[0] for element in GetThings(cur)], readonly=True, key="-CHOSPRINTER2-",size = (33,1), change_submits=True),sg.Button("Editar",key ="-EDITPRINTER2-")]])]],vertical_alignment='center', justification='center')],
                
    [sg.Column([[Collapse([[sg.Text("Selecciona perfil de impresora válido", auto_size_text=True,text_color="red",justification="center")]],"-CHECKPRINTER2-", False)]], vertical_alignment="center",justification="center")],
    
        [sg.Column([[sg.Frame(title="",layout=[[sg.Text('· Tiempo de impresión', size=commonParams[0]),
        	sg.Text("(Horas:Minutos)", size=commonParams[0]),
         	sg.Input(key='-INaccess12-', size=commonParams[1], enable_events=True)],
        [sg.Text('· Material Consumido', size=commonParams[0]),
        	sg.Text("(Gramos)", size=commonParams[0]),
         	sg.Input(key='-INaccess22-', size=commonParams[1], enable_events=True)],
        [sg.Text('· Coste de laminado', size=commonParams[0]),
        	sg.Text("(Euros)", size=commonParams[0]),
         	sg.Input(key='-INaccess32-', size=commonParams[1], enable_events=True)]])]], 				vertical_alignment='center', justification='center')],
        [sg.Column([[Collapse([[sg.Text("Dato mal introducido",size=commonParams[3],key="-CHECKINPUTS2-",text_color="red",justification="center")]],"-COLUMNINPUTS2-", False)]], vertical_alignment="center",justification="center")],
        [sg.Checkbox('Activar Opciones de Venta',
                     enable_events=True, key='-CHbox2-', font=commonParams[2])],
        
        [sg.Column([[Collapse(
            [[sg.Text("· Margen de Venta (%)", size=commonParams[0]), sg.Input(key='-INaccess42-', size=commonParams[1], enable_events=True)],
             [sg.Text("· Porcentaje de IVA (%)", size=commonParams[0]), sg.Input(key='-INaccess52-', size=commonParams[1], enable_events=True),
              sg.Help("Ayuda", tooltip="Margen de ventas debe ser 0 o superior", key="-Help2-", pad=((5, 0), (0, 0)), button_color=("blue"))]], '-Token2-', False)]], vertical_alignment='center', justification='center')],
        [sg.Text("")],
        [sg.HorizontalSeparator()],
      
        [sg.Column([
        	[sg.Column([[sg.Text("Coste Total", size=commonParams[4],justification="center",font=commonParams[2])]], justification="center")],
        	[sg.Column([[sg.Text("0 €",text_color="orange", key="-Text1-", size=commonParams[4],
                 	font=commonParams[5], justification="center")]], justification="center")],
            [sg.HorizontalSeparator(pad=((0,0), (5,5)))],
            [sg.Column([[sg.Text("Precio Venta", size=commonParams[4],justification="center",font=commonParams[2])]], justification="center")],
        	[sg.Column([[sg.Text("0 €",text_color="orange", key="-Text2-", size=commonParams[4],
                 	font=commonParams[5], justification="center")]], justification="center")]],justification="center"),
        	sg.VerticalSeparator(pad=((0,20),(0,0))),
            sg.Column([[sg.Multiline(reroute_stderr=False,autoscroll=True,size=(22,9),key="-OUTPUTPRINT-",reroute_stdout=True, disabled=True)]], justification="center", vertical_alignment="center")],
            
    
        [sg.HorizontalSeparator(pad=((0,0), (0,0)))],
        [sg.Text("")],
        [sg.Column([[sg.Button("Calcular", font=commonParams[2], key="-INsubmit2-", auto_size_button=True, pad=((0, 0),(0,0))), 
                     sg.Button("Reiniciar", key="-Reset2-", font=commonParams[2], pad=((20, 0), (0, 0)))]],
                     justification ="center")],
      
    ]

    layoutMain = [[sg.Column(layout1, key='-COL1-'),
                   sg.Column(layout2, visible=False, key='-COL2-')]]

    window = sg.Window('Estimador de costes', layoutMain, icon='input/LogoIcon.ico')

    layout = 1
    opened = False
    checkSaved = False
    while True:
        event, values = window.read()
        if event == f'-CHbox{layout}-':
            opened = not opened
            window[f'-CHbox{layout}-'].update(opened)
            window[f'-Token{layout}-'].update(visible=opened)

        if event == f"-Help{layout}-":
            sg.popup("Margen de ventas debe ser 0 o superior para poder introducir el porcentaje de IVA",
                     title="Ayuda IVA", grab_anywhere=False)

        if event == f"-Reset{layout}-":
            Reset(window, layout)
            
        try:
            if values[f"-INaccess4{layout}-"] == "":
                window[f"-INaccess5{layout}-"].update("", disabled=True)
            else:
                window[f"-INaccess5{layout}-"].update(disabled=False)
        except TypeError:
            break
        
    #Al clickar el botón para calcular costes
        if event == f"-INsubmit{layout}-":

            '''
            Evalúa si hay un perfil de impresora seleccionado
        '''
            chosPrinter = ""
            if values[f"-CHOSPRINTER{layout}-"] == "":
                window[f"-CHECKPRINTER{layout}-"].update(visible=True)
                chosPrinter = False
            else:
            	window[f"-CHECKPRINTER{layout}-"].update(visible=False)
       
       
            '''
            Evalúa si los input introducidos son válidos
        '''
            badInputs = []
            checkTime = TimeValidation(values[f"-INaccess1{layout}-"])
            if checkTime==False:
            	badInputs.append("Tiempo")
            if MainValidation(values[f"-INaccess2{layout}-"])==False:
            	badInputs.append("Material")
            if MainValidation(values[f"-INaccess3{layout}-"])==False and values[f"-INaccess3{layout}-"]!="0":
                badInputs.append("Laminado")
            if badInputs == []:
                window[f"-COLUMNINPUTS{layout}-"].update(visible=False)
            else:
            	window[f"-CHECKINPUTS{layout}-"].update(value=", ".join(badInputs)+": mala introducción")
            	window[f"-COLUMNINPUTS{layout}-"].update(visible=True)
            
            if chosPrinter != "" or badInputs != []:
            	continue
            	
            
            '''
            Envía la información formateada a las funciones de cálculo de costes
        '''	
            marginSales = ManageSales(MainValidation(values[f"-INaccess4{layout}-"]))
            
            ivaTax = ManageSales(MainValidation(values[f"-INaccess5{layout}-"]))

            electricityCost = KwCost(RefactorSupport(cur, values[f"-CHOSPRINTER{layout}-"],"KWprinter"),
            			RefactorSupport(cur, values[f"-CHOSPRINTER{layout}-"],"KWprize"),
            			checkTime)
            				
            materialCost = FilamentCost(RefactorSupport(cur,values[f"-CHOSPRINTER{layout}-"],"SpoolCost"), 
            				RefactorSupport(cur,values[f"-CHOSPRINTER{layout}-"],"SpoolWeight"),
            				MainValidation(values[f"-INaccess2{layout}-"]))
            				
            amortCost = AmortCost(RefactorSupport(cur,values[f"-CHOSPRINTER{layout}-"],"PrinterCost"), 
            				RefactorSupport(cur,values[f"-CHOSPRINTER{layout}-"],"AmortPrinter"),
            				checkTime)
            				
            designCost = MainValidation(values[f"-INaccess3{layout}-"])
            
            print(f"--------------\nCoste Electricidad: {electricityCost}\nCoste Material: {materialCost}\nCoste Laminado: {designCost}\nCoste Amortización: {amortCost}\n")
            
            '''
            Gestiona la información recibida de las funciones de costes y las muestra
        '''
            totalCost = round(electricityCost+materialCost+amortCost+designCost,2)
            salesCost = round((totalCost*marginSales)*ivaTax,2)
            
            marginCostPrint = abs(round(totalCost*(marginSales-1),2))
            ivaCostPrint = abs(round(salesCost-totalCost-totalCost*(marginSales-1),2))
            print(f"Margen de venta: {marginCostPrint}\nCoste IVA: {ivaCostPrint}\n--------------")
    

            window["-Text1-"].update(f"{totalCost} €")
            window["-Text2-"].update(f"{salesCost} €")


            '''
            Guarda la información introducida entre cambio de layouts
            '''
            if checkSaved == False:
                window[f'-COL{layout}-'].update(visible=False)

                # layout = 1 if layout == 2 else 2
                layout = 2

                if opened != False:
                    window[f'-CHbox{layout}-'].update(value=True)
                    window[f'-Token{layout}-'].update(visible=opened)
                
                window[f"-CHOSPRINTER{2 if layout == 2 else 1}-"].update(
                        values[f"-CHOSPRINTER{1 if layout == 2 else 2}-"])

                for element in range(1, 6):
                    window[f"-INaccess{element}{2 if layout == 2 else 1}-"].update(
                        values[f"-INaccess{element}{1 if layout == 2 else 2}-"])

                window[f'-COL{layout}-'].update(visible=True)
                checkSaved = True
        
        '''
        Redirige al apartado de gestión de perfiles de impresora
        '''
        if event == "Opciones" or event == f"-EDITPRINTER{layout}-":
        	PopupOptions(con, cur)
        	window.Element(f"-CHOSPRINTER{2 if layout == 2 else 1}-").update(values=[element[0] for element in GetThings(cur)])

        '''
        Cierra la ventana
        '''
        if event == sg.WIN_CLOSED or event =="Salir":
            break

    window.close()
예제 #6
0
    def _create_filter_frame(self):
        self.letters_filter_input = sg.InputText(
            default_text="",
            size=(30, 1),
            pad=(0, 1),
            enable_events=True,
            text_color=sgh.INPUT_COLOR,
            key=WordTab.EventKeys.SCHEDULE_UPDATE_FILTER)

        self.book_filter_dropdown = sg.Combo(
            values=["All"],
            default_value="All",
            size=(25, 1),
            pad=(0, 1),
            enable_events=True,
            readonly=True,
            text_color=sgh.DROP_DOWN_TEXT_COLOR,
            font=sgh.SMALL_FONT_SIZE,
            background_color=sgh.NO_BG,
            key=WordTab.EventKeys.UPDATE_FILTER)

        self.group_filter_dropdown = sg.Combo(
            values=["None", "All"],
            default_value="None",
            size=(25, 1),
            pad=(0, 1),
            enable_events=True,
            readonly=True,
            text_color=sgh.DROP_DOWN_TEXT_COLOR,
            font=sgh.SMALL_FONT_SIZE,
            background_color=sgh.NO_BG,
            key=WordTab.EventKeys.UPDATE_FILTER)

        info_button = sg.Help("?",
                              size=(3, 1),
                              pad=(10, 1),
                              key=WordTab.EventKeys.REGEX_HELP)

        def _create_int_input():
            """ Helper sub-function for creating an int input text """
            return sg.InputText(default_text="",
                                size=(10, 1),
                                pad=(10, 1),
                                enable_events=True,
                                background_color=sgh.THEME["INPUT"],
                                text_color=sgh.INPUT_COLOR,
                                key=WordTab.EventKeys.SCHEDULE_UPDATE_FILTER)

        line_filter = _create_int_input()
        line_index_filer = _create_int_input()
        sentence_filter = _create_int_input()
        word_index_filter = _create_int_input()
        sentence_index_filter = _create_int_input()
        paragraph_filter = _create_int_input()

        self.int_filters = ((paragraph_filter, "paragraph"), (sentence_filter,
                                                              "sentence"),
                            (line_filter, "line"), (word_index_filter,
                                                    "word_index"),
                            (sentence_index_filter, "sentence_index"),
                            (line_index_filer, "line_index"))

        clear_filter_button = sg.Button(button_text="Clear Filter",
                                        size=(10, 1),
                                        pad=(30, 0),
                                        key=WordTab.EventKeys.CLEAR_FILTER)

        col1 = sg.Column(
            layout=[[
                sg.Text("Book:", pad=(0,
                                      5), size=(10,
                                                1)), self.book_filter_dropdown
            ],
                    [
                        sg.Text("Group:", pad=(0, 5), size=(
                            10, 1)), self.group_filter_dropdown
                    ]])

        col2 = sg.Column(
            layout=[[sg.Text("Line:", pad=(0, 5), size=(11, 1)), line_filter],
                    [
                        sg.Text("Line Index:", pad=(0, 5), size=(
                            11, 1)), line_index_filer
                    ]])

        col3 = sg.Column(layout=[
            [sg.Text("Sentence:", pad=(0, 5), size=(13, 1)), sentence_filter],
            [
                sg.Text("Sentence Index:", pad=(0, 5), size=(
                    13, 1)), sentence_index_filter
            ]
        ])

        col4 = sg.Column(layout=[[
            sg.Text("Paragraph:", pad=(0, 5), size=(13, 1)), paragraph_filter
        ], [
            sg.Text("Word Index:", pad=(0, 5), size=(13, 1)), word_index_filter
        ]])

        frame_layout = [[col1, col2, col3, col4],
                        [
                            info_button,
                            sg.Text("Word:", pad=(10, 5)),
                            self.letters_filter_input, clear_filter_button
                        ], [sg.Sizer(h_pixels=10000)]]

        frame = sg.Frame(title="Words Filter",
                         layout=frame_layout,
                         size=(10, 100),
                         pad=(0, (0, 10)),
                         title_location=sg.TITLE_LOCATION_TOP,
                         element_justification=sgh.CENTER)

        return frame
예제 #7
0
def mainGui() -> None:
    """The main GUI code. This is essentially the new main as a gui"""
    # layout for the file selection window
    fileSelectionLayout = [
            [sg.Text('Al-Pro Export', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText(''), sg.FileBrowse(), sg.Help(key="helpAlPro")],
            [sg.Text('Quickbooks Export', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText(''), sg.FileBrowse(), sg.Help(key="helpQB")],
            [sg.Submit()]
    ]

    fileSelectionWindow = sg.Window('Accounts Compare').Layout(fileSelectionLayout)

    while True:
        event, values = fileSelectionWindow.Read()
        if event == sg.WIN_CLOSED:
            break
        if event == "helpAlPro":
            sg.popup("The alpro file should be a tab separated file with the following fields in any order:\nInvoiceNo, InvoiceDate, AgencyName, TotalDue")
        if event == "helpQB":
            sg.popup("The QuickBooks export should have an initial column with the following fields (additional fields are ignored):\n"
            "Num, Date, Name, Amount, Account\nIt should be immediately followed by data on the next row")
        # if the event isn't none and values were supplied (the success case)
        if event == "Submit" and values[0] and values[1]:
            fileSelectionWindow.Close()
            # process the input and get our text back
            result = processInput(values[0], values[1])
            # layout of the results
            resultLayout = [
                [sg.Multiline(default_text=result, size=(130, 30), disabled=True)],
                [sg.Text('Choose a folder to save process.log to', size=(30, 1), auto_size_text=False, justification='right'),
                    sg.InputText(), sg.FolderBrowse()],
                [sg.Save(tooltip='Click to submit this window'), sg.Cancel()]
            ]

            # run the window
            resultWindow = sg.Window('Results').Layout(resultLayout)
            event, values = resultWindow.Read()

            # There's a save button. it allows us to choose where to save file file. If the values[1] is set that means the user has picked a location to save the file at.
            if event == 'Save':
                if values[1]:
                    with open(os.path.join(values[1], 'comparison.log'), 'w') as file:
                        file.write(result)
                else:
                    with open('comparison.log', 'w') as file:
                        file.write(result)
            resultWindow.Close()
            break