Guest User

Untitled

a guest
Jun 18th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. from PIL import ImageGrab, ImageOps
  2. import Image
  3. import sys, os
  4. #import win32api, win32con
  5. import time
  6.  
  7.  
  8. def getWindowPos():
  9. found = 0
  10. im = ImageGrab.grab()
  11. winLeft = im.size[0] / 2
  12. print winLeft
  13. winTop = im.size[1] / 2
  14. print winTop
  15. while found == 0:
  16. winLeft -= 1
  17. if im.getpixel((winLeft, winTop)) == (8, 85, 221):
  18. found = 1
  19.  
  20. found = 0
  21. while found == 0:
  22. winTop -= 1
  23. if im.getpixel((winLeft, winTop)) == (1, 68, 208):
  24. found = 1
  25.  
  26. return (winLeft, winTop)
  27.  
  28.  
  29.  
  30. def main():
  31. print getWindowPos()
Add Comment
Please, Sign In to add comment