So I can use PIL to grab a screenshot of the desktop, and then use pywin32 to get its rectangle and crop out the part I want. However, if there's something in front of the window I want, it'll occlude the application I wanted a screenshot of. Is there any way to get what windows would say an application is currently displaying? It has that data somewhere, even when other windows are in front of it.
If you can, try saving the order of the windows, then move your app to the front, screenshot, and move it back really quickly. Might produce a bit of annoying flicker, but it might be better than nothing.
Screenshot an application, regardless of what's in front of it?