# 點選執行對應腳本
# ?如何展示腳本的資料
# ?如何運行與停止腳本
# ?可能遇到的問題
from runpy import run_path
from tkinter import *
# from multiprocessing import Process
import multiprocessing
## app exe -> id ---> pid(運行的id)
# |script| -> func1 -> func2 --> func3
# |App| -> display() & if do() -> update_style() & if do()
# 流程
def make_app():
app = Tk()
app.geometry('300x500')
Button(text= 'run', command=run_script).pack()
Button(text='stop', command=stop_script).pack()
return app
def run_script():
print('hi there')
p = multiprocessing.Process(name='print', target=lambda:run_path('test.py'))
p.start()
#def stop_script():
for p in multiprocessing.active_children():
if p.name == 'print':
:
print(multiprocessing.active_children())
app.after(1000, watcher)
if __name__ == '__main__':
app = make_app()#app. after(0, watcher)
app.mainloop()
既然选择了远方,便只顾风雨兼程