在Python3.x中获取屏幕上像素的颜色
问题描述:
我想在Python3.x中获取屏幕上像素的颜色。 (例如x,y) 我在windows上工作。并使用tkinter。 但是,它不能在Python 3.x中使用PIL。在Python3.x中获取屏幕上像素的颜色
我该怎么做。 谢谢。
答
您可以在Python3.x上使用PIL;有一个binary installer for Windows。该代码可能无法正常工作,这两个是Python2.x和Python3.x:
try: import Image # Python 2.x
except ImportError:
from PIL import Image # Python 3.x
您可以捕捉使用grab()
method模拟的屏幕面积。
+0
我找不到PIL for python3.x。 – user1161599 2012-02-06 06:01:07
+0
@ user1161599:点击[上述链接](http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil)。 – jfs 2012-02-06 07:47:45
您需要某种类型的GUI库,例如wx,GTK,KDE或wind32或任何OSX被调用的GUI库。他们每个人都会有不同的做法。 – 2012-02-03 16:11:31
在win32的情况下。怎么能? – user1161599 2012-02-04 04:32:54
不是线索,但你应该在问题中包含这些信息。 – 2012-02-04 07:13:57