【发布时间】:2019-10-02 13:27:25
【问题描述】:
我的代码:
import threading
import time
import subprocess
Thread1 = threading.Thread(target=Run_exe)
def run_exe():
subproccess.call("game.exe")
while True:
time.sleep(3600)
x = int(input(""))
if x==1:
Thread1.start()
else:
Thread1.join()
我的目标如下:
使用 Run_exe 函数运行游戏
退出游戏时杀死线程
我不想从游戏本身退出游戏 Python 程序应该通过终止线程获得输入以退出游戏。
【问题讨论】:
-
您有问题吗?
-
是的,如何使用 python 运行游戏并使用 python 退出它,而不会干扰使用函数和线程的游戏
-
你为什么使用线程?
标签: python subprocess python-multithreading