getting the color of pixels on the screen in Python3.x

一世执手 提交于 2019-12-13 03:39:59

问题


I want to get the color of pixels on the screen in Python3.x. (example x,y) I work on windows. and using tkinter. But, It can't use PIL in Python 3.x.

How can i do this. Thank you.


回答1:


You can use PIL on Python3.x; there is a binary installer for Windows. The code might not work as is both on Python2.x and Python3.x:

try: import Image         # Python 2.x
except ImportError:
    from PIL import Image # Python 3.x

You could capture an area of the screen using an analog of grab() method.



来源:https://stackoverflow.com/questions/9130982/getting-the-color-of-pixels-on-the-screen-in-python3-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!