Iv'e recently started learning python programming and ran into some problems with my first program. It's a program that auto-saves print screens.
If i have a print screen saved in clipboard and start the program it outputs a .png file. if i start the program with nothing in clipboard and then press print screen it outputs a .png file.
But if i press print screen after the program has already printed a .png file it does absolutely nothing. Can't even use ctrl+c to copy text.
This is the code im using.
from PIL import ImageGrab
from Tkinter import Tk
import time
r = Tk()
while True:
try:
im = ImageGrab.grabclipboard()
date = time.strftime("%Y-%m-%d %H.%M.%S")
im.save(date + ".png")
r.clipboard_clear()
except IOError:
pass
except AttributeError:
pass