how to select area on window using python code example
Example: how to drag a box on your screen python
import win32gui
import win32ui
import win32con
import win32api
def saveScreenShot(x,y,width,height,path):
hdesktop = win32gui.GetDesktopWindow()
desktop_dc = win32gui.GetWindowDC(hdesktop)
img_dc = win32ui.CreateDCFromHandle(desktop_dc)
mem_dc = img_dc.CreateCompatibleDC()
screenshot = win32ui.CreateBitmap()
screenshot.CreateCompatibleBitmap(img_dc, width, height)
mem_dc.SelectObject(screenshot)
mem_dc.BitBlt((0, 0), (width, height), img_dc, (x, y),win32con.SRCCOPY)
screenshot.SaveBitmapFile(mem_dc, path)
mem_dc.DeleteDC()
win32gui.DeleteObject(screenshot.GetHandle())