Cross-platform application restart?

  • Thread starter Heikki Toivonen
  • Start date
H

Heikki Toivonen

Is there any way to restart a Python (GUI) application that would work
on Windows, Mac OS X and Linux? I'd like to provide a "restart" button
to a dialog that would restart the application to pick new changes or
start with different options.
 
F

faulkner

asynchronously start a process which waits for the parent to close,
then starts your script.

cmd = "python -c 'import time,os;time.sleep(2);os.system(YOUR_SCRIPT)'"
if os.name == 'nt':
cmd = 'start ' + cmd
else:
cmd += ' &'
subprocess.Popen(cmd, shell=True)
sys.exit()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top