python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.42k stars 586 forks source link

execute python code after window is closed. #583

Open momar95 opened 2 years ago

momar95 commented 2 years ago

Describe the problem I want to run one/two python code after my GUI gets closed.

I already use alocation.realod() function in some places, which is why i cant use js (beforeunload). Therefore I wanted to know at which point in the project I would have to put my python code. I have a while loop for eel.sleep. But when I close and try to print something afterwards it doesnt happen. I assume it would have to go in another place


def main():
    app = App()
    app.mainloop()
    print("Hello world")
if __name__ == '__main__':
    main()