Closed rsohlot closed 5 years ago
hey @rsohlot as i did a search after i got the same error this screencapture command work for mac os so i returned to the readme and found out it says the keys are for macos for now you have to make it crossplatform so i found out this code is for mac not for windows and u have to make it work for windows good luck i am gonna try my best as i learned python yesterday and i will keep u updated
I use the following code on my side:
def screenshot(x, y, w, h):
#f_name = 'tmp-{0}.png'.format(datetime.utcnow().isoformat('-').replace(':', '-'))
f_name = 'tmp.png'
os.system("screenshot.exe -rc {0} {1} {2} {3} -o {4}".format(x, y, w, h, f_name))
img = Image.open(f_name)
return img
And in parallel used the following light utility for windows machine - https://github.com/chuntaro/screenshot-cmd. You need to add this exe file to the folder where all *.py files are located.
Hey @rsohlot, as mentionned above, screencapture
is the cli tool I used to take screenshots. A possible improvement could be to use https://pypi.org/project/pyscreenshot/ for example so that it can be download and use by everyone on every OS :+1:
@utay thank you> I will try it.
ERROR:'screencapture' is not recognized as an internal or external command, operable program or batch file. can you please explain the line"os.system("screencapture -R{},{},{},{} tmp.png".format(x, y, w, h))"