该
show方法“主要用于调试目的”,并产生一个外部进程,您无法获得该进程的句柄,因此无法以适当的方式终止它。
与PIL,你可能想使用其GUI模块之一,如
ImageTk,
ImageQt
或
ImageWin。
否则,只需使用以下
subprocess模块从Python手动生成图像查看器:
for infile in glob.glob( os.path.join(path, '*.png')): viewer = subprocess.Popen(['some_viewer', infile]) viewer.terminate() viewer.kill() # make sure the viewer is gone; not needed on Windows



