我是python的新手,最近我正在尝试在需要在不同python模块之间进行屏幕切换的桌面应用程序上工作。我已经使用多处理库在不冻结GUI的情况下同时运行不同的python模块,但是问题是,如果我有一个父窗口(根),该窗口具有正在运行的进程以打开其中带有GUI的另一个python脚本,则该父窗口当我调用top.destroy()方法时,窗口将冻结。 These are my list of python modules. It freezes up my login screen when the registration screen pops-up.
import tkinter
import os
import platform
from MMCS_DB import validate_user, get_logged_in_user, get_user_position
import multiprocessing
top = tkinter.Tk()
top.geometry("800x600")
top.title("Multimedia Consultation Software")
top.resizable(False, False)
class multiProcessWork():
def s1(self): # this is where it runs all the modules
if platform.system() == "Windows":
os.system('MMCS_registration.py')
elif platform.system() == "Linux":
os.system('python3')
elif platform.system() == "Darwin":
os.system('python3 ./MMCS_registration.py')
def s2(self):
if platform.system() == "Windows":
os.system('student_main.py')
elif platform.system() == "Linux":
os.system('python3')
elif platform.system() == "Darwin":
os.system('python3 ./student_main.py')
def s3(self):
if platform.system() == "Windows":
os.system('lecturer_main.py')
elif platform.system() == "Linux":
os.system('python3')
elif platform.system() == "Darwin":
os.system('python3 ./lecturer_main.py')
def registerFunc():
p1 = multiprocessing.Process(target=multiProcessWork().s1, args=())
p1.start()
top.destroy()
print("register") # here's the function which it will bring up a new registration screen.
因此,我想在显示新窗口时销毁父窗口。有什么办法吗?