【问题标题】:getting the color of pixels on the screen in Python3.x在 Python3.x 中获取屏幕上像素的颜色
【发布时间】:2012-02-03 15:18:55
【问题描述】:

我想在 Python3.x 中获取屏幕上像素的颜色。 (例如 x,y) 我在窗户上工作。并使用 tkinter。 但是,它不能在 Python 3.x 中使用 PIL。

我该怎么做。 谢谢。

【问题讨论】:

  • 您需要某种 GUI 库,如 wx、GTK、KDE ​​或 wind32 或任何 OSX 库。他们每个人都有不同的方法来做到这一点。
  • 没有线索,但您应该在问题中包含该信息。

标签: colors get python-3.x screen


【解决方案1】:

您可以在 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 的模拟来捕获屏幕区域。

【讨论】:

  • 我找不到 python3.x 的 PIL。
  • @user1161599:点击the above link
猜你喜欢
  • 2015-02-08
  • 1970-01-01
  • 2014-04-08
  • 1970-01-01
  • 1970-01-01
  • 2013-07-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多