for image_file in glob.iglob('*.png'):
try:
img = (os.path.join(image_file))
img_read = cv2.imread(img)
img_show = cv2.imshow('IMG', img_read)
if НАЖИМАЮ КНОПКУ 1:
shutil.move(img, folder1)
if НАЖИМАЮ КНОПКУ 2:
shutil.move(img, folder2)
except BaseException:
pass
try: # used try so that if user pressed other than the given key error will not be shown
if keyboard.is_pressed('q'): # if key 'q' is pressed
print('You Pressed A Key!')