本文整理汇总了Python中region.Region.color_at方法的典型用法代码示例。如果您正苦于以下问题:Python Region.color_at方法的具体用法?Python Region.color_at怎么用?Python Region.color_at使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类region.Region
的用法示例。
在下文中一共展示了Region.color_at方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: raw_input
# 需要导入模块: from region import Region [as 别名]
# 或者: from region.Region import color_at [as 别名]
print '''This is a demo that takes control of you mouse and keyboard.
So don't freak out and don't interfere if you don't want random things to
happen to your Master Race PC.
Press enter when you're ready.'''
raw_input()
# Demo imports
import random
import string
random.seed(1337)
for i in range(10):
print '=' * 80
# Screen pixel colors
pos = (random.randint(0, screen_width), random.randint(0, screen_height))
print 'Color at position %s is %s' % (pos, r.color_at(*pos))
# Screen pixel colors 2
x, y = (random.randint(0, screen_width), random.randint(0, screen_height))
print 'Red at position %s is %s' % ((x, y), r.color_at(x, y)[0])
print 'Green at position %s is %s' % ((x, y), r.color_at(x, y)[1])
print 'Blue at position %s is %s' % ((x, y), r.color_at(x, y)[2])
# Mouse movement
pos = (random.randint(0, screen_width), random.randint(0, screen_height))
print 'Setting mouse position to (%s - %s)' % pos
mouse.move(*pos)
# Keyboard input
key = random.choice(string.lowercase)
print 'Pressing %s button on the keyboard.' % key
keyboard.tap_key(key)
sys.stdout.flush()
time.sleep(0.2)