How to solve GUI not reusing layout issue

35 Views Asked by At

So basically, until now I've been using the PySimplyGUI in my programme, but now it's "feature" of not being able to reuse the same layout more then once has become quite an issue. Is there any library for gui's that would require minimal change to the code, and allows the reuse of layouts? Or a workaround to still use PySimpleGUI and reuse the layouts somehow?

Below is the code I have so far, the layouts themselves are not shown, the Receipt class, and def functions are also not shown.

while True:
    event, values = window.read()
    # End program if user closes window or
    # presses the OK button
    if event == "Close" or event == gui.WIN_CLOSED:
        break
    elif event == "Make a new Fast Sheet":
        window = gui.Window("File Loader", layout_upload)
        event, values = window.read()
        if event in (gui.WIN_CLOSED, "Exit"):
            window.close()
        elif event == "Submit":
            file_address = values['-FILE_PATH-']
            receipt1 = Receipt(storedef(), categorydef(), "num", unitdef(), "nums", "2", "200")
            receipt1.Notebook()
            window = gui.Window("Fast Sheets", layout_create1, size=(1000, 1000))
            
    elif event == "Log in":
        window = gui.Window("Fast Sheets", layout_login, size=(1000, 1000))
    elif event == "-INPUT-":
        if values['-INPUT-'][-1] not in ('0123456789'):
         gui.popup("Only digits allowed")
         window['-INPUT-'].update(values['-INPUT-'][:-1])
0

There are 0 best solutions below