本文整理匯總了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)