Table of Contents
1. Automatic screenshots
So for a long time I have taken all my screenshots by hand, until I finally got tired of doing that yesterday. I finally decided to automate that garbage.
I wanted to create a simple script to take a screenshot of chess positions, very simple. One additional thing I might want to add to this script as well would be uploading the images to imgur or something similar.
The actual code part is very small, but it is a huge relief to have written this code.
#!/usr/bin/python from PIL import ImageGrab from datetime import datetimeUPPERX = 510
UPPERY = 160
LOWERX = UPPERX+830
LOWERY = UPPERY+800pic = ImageGrab.grab(bbox=(UPPERX,UPPERY,LOWERX,LOWERY))
timeNow = datetime.now()
filestr = f'{timeNow.year}{timeNow.month}{timeNow.day}-{timeNow.hour}{timeNow.minute}{timeNow.second}.png'
pic.save(filestr)
This small piece of code simply takes a screenshot, figuring out the exact coordinates was a bit trial and error. But having found the coordinates I can just use this script for all the screenshots If you copy this you might need to tweak it a little, I have a bar at the top of my window, and some empty pixels around the window.
Anyway just a quick snippet.