Reputation: 600
I want to take a print screen of a particular window on my PC by running the python program and it taking that screen shot, before cropping it and comparing its hex value to other hex values in a SQL server.
I have thought about letting it wait 10 seconds whilst I get the other window up and then start taking the print screens continuously until one matches.
I was just wondering if I can use python to maximize that particular window that I want to print screen automatically and then have it take a print screen.
If not, could I take a print screen (a picture) of a window that is minimized? (I think this is impossible)..
Thanks!
Upvotes: 3
Views: 3103
Reputation: 33111
If you do a quick Google search, you will find this helpful tutorial that uses PIL to take a screenshot of a desktop:
Assuming you're on Windows, you would need to use PyWin32 (or possibly pywinauto) to get the window you want. These two links will help with that:
Then you could use MoveWindow to resize the window you found before taking the screenshot:
Upvotes: 1