当前位置: 首页>>代码示例>>Python>>正文


Python Region.color_at方法代码示例

本文整理汇总了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)
开发者ID:jsartisohn,项目名称:pautoit,代码行数:32,代码来源:pautoit.py


注:本文中的region.Region.color_at方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。