我想要桌面背景应用程序的RGB颜色信息,并在一定间隔之间输入像素。我该怎么办?
假设您在Windows / macOS上,则可以使用PIL
或类似这样的fork Pillow
:
import PIL.ImgaeGrab # Pillow is also imported as PIL
x = y = 10
pixel = (x, y)
scrn = PIL.ImageGrab.grab()
scrn.getpixel(pixel)
>>> (246, 138, 30) # The result for me
对于其他捕获屏幕的方法,您可能会看起来here
对于时间间隔,只需使用time.sleep(seconds)