Cross-platform application restart?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Heikki Toivonen

    #1

    Cross-platform application restart?

    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.

    --
    Heikki Toivonen
  • faulkner

    #2
    Re: Cross-platform application restart?

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

    cmd = "python -c 'import time,os;time.sl eep(2);os.syste m(YOUR_SCRIPT)' "
    if os.name == 'nt':
    cmd = 'start ' + cmd
    else:
    cmd += ' &'
    subprocess.Pope n(cmd, shell=True)
    sys.exit()

    Heikki Toivonen wrote:
    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.
    >
    --
    Heikki Toivonen

    Comment

    Working...