使用子进程调用时,应用程序无响应

时间:2019-05-12 14:58:31

标签: python python-3.x tkinter

当我使用subprocess.call([''notepad.exe',path])时,我的应用程序没有响应。有人知道原因吗?

(记事本正确打开路径中的文件)

Open a text file using notepad as a help file in python?

1 个答案:

答案 0 :(得分:1)

您正在负责GUI的线程上运行此命令。仅在被调用程序终止时才返回对subprocess.call的调用。在它仍在运行时,该功能只是坐在那里等待,因此您的GUI也被迫等待。

为避免这种情况,请在另一个线程中运行此功能或使用a non-blocking cousin of subprocess.call