當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。