jacksonwelsh
jacksonwelsh

Reputation: 173

Open python applet, quit enclosing applet

This is really hard to put into words.

I have two applets: Applet A and Applet B. Applet A needs to be able to open Applet B based on a certain interaction, then quit itself, and vice versa.

Here's kind of what I'm looking for:

#Applet A

if [user interaction]
    open Applet B
    quit Applet A, but keep B open

#Applet B

if [another user interaction]
    open Applet A
    quit Applet B, but keep A open

(obviously this would be actual code, but trying to keep it simple here)

Thanks in advance for your help!

Upvotes: 0

Views: 104

Answers (1)

meyer9
meyer9

Reputation: 1140

It's hard to understand fully what you mean, but you could use os.system to start the next process.

import os, sys
os.system('python appletB.py')
sys.exit(0)

A better way of doing this is to not use two processes and just use two threads with a master process to control each. Then it gets a bit complicated with making sure the variables are thread-safe if you want to communicate between them.

Upvotes: 1

Related Questions