while doing this loop, I would like the image shown to be closed after entering the input, and for the next iteration it would be a repeated cycle for each image.
Currently, in the second iteration, two photos open to me in the next 3, etc.
app.py
i = 0
for file in os.listdir(path):
process_list = []
for proc in psutil.process_iter():
process_list.append(proc)
with Image.open(path + "/" + file) as img:
img.show()
kod = input("Insert code: ")
for proc in psutil.process_iter():
if not proc in process_list:
proc.kill()
os.rename(path + "/" + file,path + "/" + directory + "_{0:03}_".format(i) + kod + '.jpg')
i+=1