Il y aura des problèmes sous Windows
时光@记忆
时光@记忆 2020-03-04 18:45:39
0
0
910

# Cliquez pour exécuter le script correspondant
#? Comment afficher les données du script
# ? Comment exécuter et arrêter le script
# ? Problèmes possibles

from runpy import run_path
from tkinter import *
# from multiprocessing import Process
import multiprocessing
# app exe -> pid (running id)

# |script -> -> func2 --> func3
# |App | -> display() & if do() -> update_style() & if do()
# Processus

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('salut')
p = multiprocessing.Process(name='print', target=lambda:run_path('test.py'))
p.start()


def stop_script ():
pour p dans multiprocessing.active_children():
if p.name == 'print':
p.terminate()

def watcher():
print(multiprocessing.active_children())
app.after (1000, observateur)

if __name__ == '__main__':
app = make_app()
app.after(0, watcher)
app.mainloop()














时光@记忆
时光@记忆

既然选择了远方,便只顾风雨兼程

répondre à tous(0)
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!