image - python screenshot file moved or renamed -
i wrote code on python suppost take screenshot , show it. shis code:
from pil import imagegrab,image import pil def screenshot(): num=1 takescsh = imagegrab.grab() takescsh.save(str(num)+'.png') takescsh.show() num=num+1 x=raw_input() while x!='stop': screenshot() x=raw_input()
it opens windows picture viewer in picture viewer says "it looks file moved or renamed" idea why that?
in screenshot
function, num
equal 1
. so, each , every time call screenshot
, file rewritten on disk. try like:
def screenshot(num): takescsh = imagegrab.grab() takescsh.save(str(num) + '.png') takescsh.show() count = 1 while 'capturing': screenshot(count) count += 1 if raw_input() == 'stop': break
Comments
Post a Comment