本文整理汇总了Python中pyautogui.keyDown函数的典型用法代码示例。如果您正苦于以下问题:Python keyDown函数的具体用法?Python keyDown怎么用?Python keyDown使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了keyDown函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: resize
def resize(n, dir):
pag.keyDown('winleft')
pag.press('r')
pag.keyUp('winleft')
for i in range(n):
pag.press(dir)
pag.press('escape')
示例2: tick
def tick(direction='right', count=0):
global oldIm
global newIm
# no sleep but there's a long step size... is it hanging on the screenshot???
# screenGrab(count)
# oldPath, newPath = None, None
if count is 0:
newIm = screenGrab(count)
else:
oldIm = newIm
newIm = screenGrab(count)
# shouldn't be getcwding every time
# oldPath = os.getcwd() + '/caps/' + str(count - 1) + '.png'
# oldPath = s
# newPath = os.getcwd() + '/caps/' + str(count) + '.png'
# direction = bestMove(oldPath, newPath)
oldDirection = direction
direction = bestMove(oldIm, newIm)
if oldDirection not in ['space','sit']:
pyautogui.keyUp(oldDirection)
if direction not in ['space','sit']:
pyautogui.keyDown(direction)
# time.sleep(0.05)
elif direction == "space":
pyautogui.press('space')
count += 1
tick(direction, count)
示例3: _press
def _press(char):
# Convert to pyAutoGui char
if char in _ARD_TO_PYAUTOGUI_KEYS:
char = _ARD_TO_PYAUTOGUI_KEYS[char]
_pressed_list.append(char)
pyautogui.keyDown(char) # TODO - This library does not simulate read hold down
示例4: play
def play():
#get sensor data
s.getSensorData()
#sense keypress
global rc_prev
rc = s.RemoteCode
#remove double clicks
if not (rc == rc_prev):
if rc == '6C90':
hmi.keyDown('up')
hmi.keyUp('up')
elif rc == 'CC30':
hmi.keyDown('down')
hmi.keyUp('down')
elif rc == 'AC50':
hmi.keyDown('right')
hmi.keyUp('right')
elif rc == '8C70':
hmi.keyDown('left')
hmi.keyUp('left')
elif rc == '9C60':
hmi.keyDown('p')
hmi.keyUp('p')
rc_prev = rc
s.ledWrite(Red, On)
wait(20)
s.ledWrite(Red, Off)
wait(20)
示例5: do_right
def do_right(area):
print area
if area > 33000 and pressedAtt == 0:
pyautogui.keyDown("enter")
pyautogui.keyUp("enter")
global pressedAtt
pressedAtt = 1
print "ATT"
if area < 10000 and pressedDef == 0:
pyautogui.keyDown("ctrlright")
global pressedDef
pressedDef = 1
print "DEF"
else:
if pressedAtt == 1 and area < 33000:
global pressedAtt
pressedAtt = 0
if pressedDef == 1 and area > 10000:
print "DUPA"
pyautogui.keyUp("ctrlright")
global pressedDef
pressedDef = 0
示例6: play_music
def play_music(url):
webbrowser.open(url, 0, autoraise=False)
time.sleep(0.1)
pyautogui.keyDown("Alt")
pyautogui.keyDown("Tab")
pyautogui.keyUp("Alt")
pyautogui.keyUp("Tab")
示例7: close
def close():
"""
this method presses alt+f4 of the virtual key board.
"""
p.keyDown('alt')
p.keyDown('f4')
p.keyUp('f4')
p.keyUp('alt')
示例8: startup_menu
def startup_menu():
"""
this method shows the startup menu....
"""
p.keyDown('alt')
p.keyDown('f1')
p.keyUp('f1')
p.keyUp('alt')
示例9: make
def make(recipe):
pyautogui.keyDown('down')
time.sleep(2)
pyautogui.keyUp('down')
pyautogui.press('p')
if recipe.com == 's':
pyautogui.press(recipe.com)
pyautogui.press('enter')
示例10: type_this
def type_this(strings):
"""Types the passed characters with random pauses in between strokes"""
for s in strings:
# delay between key presses--key UP/DOWN
#autopy.key.toggle(s, True)
pyautogui.keyDown(s)
RandTime.randTime(0,0,0,0,0,9)
pyautogui.keyUp(s)
示例11: Tu_Dong_Go_Phim
def Tu_Dong_Go_Phim():
time.sleep(2)
i = 0
while i < 10:
i += 1
keyDown('enter', pause=0.25)
keyUp('enter', pause=0.25)
typewrite(str(i), interval=0.5)
示例12: zoom_out
def zoom_out(scale):
pyautogui.keyDown('ctrlleft')
for x in range(0,scale):
print("zooming out")
pyautogui.keyDown('-')
pyautogui.keyUp('-')
pyautogui.keyUp('ctrlleft')
return True
示例13: clicker
def clicker(coordinate): # generate click event on a particular coordinate
x = coordinate
pyautogui.keyDown('ctrlleft')
print(x)
pyautogui.moveTo(x[0], x[1], duration=0.1) # This duration specifies how speed the mouse travels
pyautogui.click(x[0], x[1])
pyautogui.keyUp('ctrlleft')
return True
示例14: copy
def copy():
"""
this method presses ctrl+c of the virtual key board.
"""
p.keyDown('ctrl')
p.keyDown('c')
p.keyUp('c')
p.keyUp('ctrl')
notify('copy '+ clipboard.paste())
示例15: youdao
def youdao():
count = 0
time.sleep(5)
while count < 90000:
pag.keyDown('up')
print(count)
time.sleep(1)
count += 1
print('done')