1
我遇到的问题实际上是在查看器中产生了显示图像的子流程。基本上我打开堆栈中的图片,并希望显示它们一段时间,然后杀死子进程。运行程序时,它显示的图片是想要的,但我无法得到实际的.kill
或.terminate
函数的工作。Python子流程不会终止
class ImageDisplay(ThreadParent):
def __init__(self, label):
ThreadParent.__init__(self, label)
def display_image(self):
image = ThreadParent.image_stack.pop(0)
cwd = os.getcwd()
# Automagically opens in preview @ osx
p = subprocess.Popen(["open", "file://%s/%s" % (cwd,
filepath(filename(image)))])
disptime = displaytime(image)
print("Displaying image:", image, "for", disptime, "seconds..")
time.sleep(disptime)
p.terminate()
p.kill()
所有帮助将不胜感激。
所有最优秀的