0

Is there a way to open an exe file with python and close the python program with out closing the regular program? I'm using PySimpleGUI to create a launcher for programs and I have this so far:

import sys
import PySimpleGUI as sg
from PySimpleGUIQt.PySimpleGUIQt import theme, theme_previewer
from os import system

programs = {
    "program1": r'"D:\\Path\\to\\program.exe"'
}

sg.theme('LightBlue')
layout = [
    [sg.Text("This is PySimpleGUI")],
    [sg.Button("Photo Shop")],
    [sg.Cancel()]
]
window = sg.Window("Game Launcher", layout)

while True:
    event, values = window.read()
    if event in (sg.WIN_CLOSED, 'Cancel'):
        break
    elif event == "Photo Shop":
        system(programs['program1'])
        break
window.close()

I can't close my .py program after I launch program1.exe without program1.exe closing too and I was wondering if it was possible to close my .py file without closing the .exe file as well.

  • try `subprocess.Popen(programs['program1'])`, refer https://stackoverflow.com/questions/89228/how-to-execute-a-program-or-call-a-system-command – Jason Yang Sep 28 '21 at 03:44

0 Answers0