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


Python pyautogui.keyDown函数代码示例

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

示例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)
开发者ID:sandhoefner,项目名称:sandhoefner.github.io,代码行数:31,代码来源:main.py

示例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
开发者ID:sagielevy,项目名称:Kommander,代码行数:7,代码来源:MessageHandler.py

示例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)
开发者ID:BOBRAPHTONE,项目名称:scratch-n-sketch,代码行数:28,代码来源:pacman.py

示例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
开发者ID:plizonczyk,项目名称:AGHacks-2015,代码行数:25,代码来源:hajs.py

示例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")
开发者ID:ofer515,项目名称:project,代码行数:7,代码来源:start.py

示例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')
开发者ID:girish946,项目名称:SG-remote,代码行数:8,代码来源:commands.py

示例8: startup_menu

def startup_menu():
    """
    this method shows the startup menu....
    """
    p.keyDown('alt')
    p.keyDown('f1')
    p.keyUp('f1')
    p.keyUp('alt')
开发者ID:girish946,项目名称:SG-remote,代码行数:8,代码来源:commands.py

示例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')
开发者ID:technicallytexan,项目名称:COOKSERVE_BOT,代码行数:8,代码来源:recipes.py

示例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)
开发者ID:jjvilm,项目名称:osrmacro,代码行数:8,代码来源:Keyboard.py

示例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)
开发者ID:sonzzdq,项目名称:PythonBasic,代码行数:8,代码来源:Auto_Keyboard_For_Windows.py

示例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
开发者ID:deeru10,项目名称:Crawler_testing,代码行数:8,代码来源:simulate_click.py

示例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
开发者ID:deeru10,项目名称:Crawler_testing,代码行数:8,代码来源:simulate_click.py

示例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())
开发者ID:girish946,项目名称:SG-remote,代码行数:9,代码来源:commands.py

示例15: youdao

def youdao():
        count = 0
        time.sleep(5)
        while count < 90000:
            pag.keyDown('up')
            print(count)
            time.sleep(1)
            count += 1
        print('done')
开发者ID:Rockyzsu,项目名称:base_function,代码行数:9,代码来源:pyautogui_mouse_simulation.py


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