• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pyautogui.moveRel函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyautogui.moveRel函数的典型用法代码示例。如果您正苦于以下问题:Python moveRel函数的具体用法?Python moveRel怎么用?Python moveRel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了moveRel函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: episode_get_mcn_and_ref

def episode_get_mcn_and_ref():
    # get mcn
    mcn = pyperclip.copy('na')
    pya.moveTo(424, 474, duration=0.1)
    pya.dragTo(346, 474, duration=0.1)
    pya.hotkey('ctrl', 'c')
    mcn = pyperclip.paste()
    pya.moveTo(424, 474, duration=0.1)
    pya.click(button='right')
    pya.moveTo(481, 268, duration=0.1)
    pya.click()
    
    mcn = pyperclip.paste()
    mcn = mcn.replace(' ', '')
    # get ref
    ref = pyperclip.copy('na')
    pya.moveTo(500, 475, duration=0.1)
    pya.dragRel(-8, 0, duration=0.1)
    pya.hotkey('ctrl', 'c')
    ref = pyperclip.paste()
    pya.moveRel(8, 0, duration=0.1)
    pya.click(button='right')
    pya.moveTo(577, 274, duration=0.1)
    pya.click()
    
    ref = pyperclip.paste()
    return mcn, ref
开发者ID:varnell-holdings,项目名称:new_billing,代码行数:27,代码来源:login_and_run.py


示例2: buscar_test

def buscar_test():
    msg = ''
    pyautogui.PAUSE = 0.5
    pyautogui.FAILSAFE = False
    pyperclip.copy('')
    
    findTest = pyautogui.locateOnScreen('buscar-tests.png')
    if findTest is None:
        msg = 'La opcion LOGIN TO CONSOLE no esta seleccionada'
        return (False, msg)
        #exit(0)
    else:
        testPos = list(findTest)
        #print testPos
         
    centroTest = pyautogui.center(testPos)     
    print centroTest
    pyautogui.moveTo(centroTest)
    pyautogui.click(None,None,1)
    pyautogui.moveRel(10, 30)
    pyautogui.click(None,None,1)
    #pyautogui.screenshot('menu-screen2.png')
    #pyautogui.click(None,None,1)
    #pyautogui.screenshot('menu-screen1.png')
    findLogin = pyautogui.locateOnScreen('imagenx.png')
    print findLogin
    
    return (True, msg)
开发者ID:josem-m,项目名称:pass_test,代码行数:28,代码来源:buscar-tests.py


示例3: main

def main():

	while True:
        	position = pyautogui.position()
		time.sleep(60)
		if position == pyautogui.position():
			pyautogui.moveRel(0,-1)
			pyautogui.moveRel(0,1)
开发者ID:dallanwagz,项目名称:py-hax,代码行数:8,代码来源:movemouse.py


示例4: get_title

 def get_title():
     pya.hotkey('alt', 't')
     title = pyperclip.copy('na')
     pya.moveTo(190, 135, duration=0.1)
     pya.click(button='right')
     pya.moveRel(55, 65)
     pya.click()
     title = pyperclip.paste()
     return title
开发者ID:varnell-holdings,项目名称:new_billing,代码行数:9,代码来源:login_and_run.py


示例5: pass_search

def pass_search():
    pyautogui.PAUSE = 0.5
    pyautogui.FAILSAFE = False
    pyperclip.copy("")

    dondeEstaElBoton = pyautogui.locateOnScreen("go-button.png")
    if dondeEstaElBoton is None:
        print "El boton de GO no fue encontrado"

    else:
        botonPos = list(dondeEstaElBoton)
        print botonPos

    centroBoton = pyautogui.center(botonPos)
    print centroBoton

    contador = 0
    while True:
        contador += 1
        pyautogui.moveTo(centroBoton)
        pyautogui.moveRel(796, 0)  # Mover el raton a la barra de desplazamiento
        pyautogui.click(None, None, 2)
        # if contador == 1:
        #    time.sleep(0.3)
        #    pyautogui.typewrite('!reset')
        #    pyautogui.press('enter')

        pyautogui.click(None, None, 1)
        pyautogui.dragRel(0, -293, 1, button="left")
        # pyautogui.scroll(10)  #Hacer scroll para llegar a la parte superior del cuadro de texto
        # pyautogui.moveRel(0, -294)   #Mover el raton a la parte superior de la barra de desplazamiento
        pyautogui.moveRel(-390, 0)  # Mover el raton a la posicion en donde se encuentra la clave

        pyautogui.PAUSE = 0.05

        pyautogui.click(None, None, 2)
        # pyautogui.doubleClick()   #Hacer dobleclic en la palabra de la clave
        pyautogui.hotkey("ctrl", "c")

        # pyautogui.doubleClick()   #Hacer dobleclic en la palabra de la clave
        # pyautogui.hotkey('ctrl', 'c')

        # pyautogui.doubleClick()   #Hacer dobleclic en la palabra de la clave
        # pyautogui.hotkey('ctrl', 'c')
        pyautogui.PAUSE = 1

        r = pyperclip.paste()
        print r

        if len(r) == 10:
            print "clave encontrada"
            break
        if contador == 5:
            print "Se hizo el intento 5 veces para buscar la clave"
            break
        time.sleep(0.5)
开发者ID:josem-m,项目名称:pass_test,代码行数:56,代码来源:lv-mani.py


示例6: test

def test():
    time.sleep(1)
    pyautogui.moveRel(1,1)
    #time.sleep(1)
    #pyautogui.click()
    #time.sleep(1)
    #pyautogui.mouseDown()
    time.sleep(1)
    
    '''
开发者ID:HesselM,项目名称:Mouser,代码行数:10,代码来源:autotest.py


示例7: fileMenu

def fileMenu():
    #!OS specific!
    #get the top left xy coords of the file menu
    try:
        x,y,bx,by = cntrl.locateOnScreen('File.png')
        cntrl.moveTo(x, y)
        cntrl.moveRel(9,35)
        cntrl.click()
       
    except:
        cntrl.alert("oops...something went wrong with File menu. See Andre")
开发者ID:Andre2099,项目名称:FA-BTLE,代码行数:11,代码来源:automateWireshark.py


示例8: go_standby

 def go_standby(self):
   self.tv_shutdown = (Main.WAIT_TIME) #reset timer
   screensize = pyautogui.size()
   pyautogui.moveTo(screensize[0]-8, 8)
   time.sleep(1)
   pyautogui.click()
   time.sleep(1)
   pyautogui.moveRel(0, 215)
   time.sleep(1)
   pyautogui.click()
   time.sleep(10)
开发者ID:imakin,项目名称:PersonalAssistant,代码行数:11,代码来源:standby-again.py


示例9: input_control

 def input_control(self, count_defects, img_src):
     # update position difference with previous frame (for move mouse)
     d_x, d_y = 0, 0
     if self.preCX is not None:
         d_x = self.ROIx - self.preCX
         d_y = self.ROIy - self.preCY
     
     # checking current command, and filter out unstable hand gesture
     cur_cmd = 0
     if self.cmd_switch:
         if self.last_cmds.count(count_defects) >= self.last_cmds.n_maj:
             cur_cmd = count_defects
             #print 'major command is ', cur_cmd
         else:
             cur_cmd = 0     # self.last_cmds.major()
     else:
         cur_cmd = count_defects
     
     # send mouse input event depend on hand gesture
     if cur_cmd == 1:
         str1 = '2, move mouse dx,dy = ' + str(d_x*3) + ', ' + str(d_y*3)
         cv2.putText(img_src, str1, (50, 50), cv2.FONT_HERSHEY_TRIPLEX, 2, (0, 0, 255), 2)
         if self.cmd_switch:
             pyautogui.moveRel(d_x*3, d_y*3)
             self.last_cmds.push(count_defects)
             #pyautogui.mouseDown(button='left')
             #pyautogui.moveRel(d_x, d_y)
         #else:
         #    pyautogui.mouseUp(button='left')
     elif cur_cmd == 2:
         cv2.putText(img_src, '3 Left (rotate)', (50, 50), cv2.FONT_HERSHEY_TRIPLEX, 2, (0, 0, 255), 2)
         if self.cmd_switch:
             pyautogui.dragRel(d_x, d_y, button='left')
             self.last_cmds.push(count_defects)
             #pyautogui.scroll(d_y,pause=0.2) 
     elif cur_cmd == 3:
         cv2.putText(img_src, '4 middle (zoom)', (50, 50), cv2.FONT_HERSHEY_TRIPLEX, 2, (0, 0, 255), 2)
         if self.cmd_switch:
             pyautogui.dragRel(d_x, d_y, button='middle')
             self.last_cmds.push(count_defects)
     elif cur_cmd == 4:
         cv2.putText(img_src, '5 right (pan)', (50, 50), cv2.FONT_HERSHEY_TRIPLEX, 2, (0, 0, 255), 2)
         if self.cmd_switch:
             pyautogui.dragRel(d_x, d_y, button='right')
             self.last_cmds.push(count_defects)
     elif cur_cmd == 5:
         cv2.putText(img_src, '1 fingertip show up', (50, 50), cv2.FONT_HERSHEY_TRIPLEX, 2, (0, 0, 255), 2)
         if self.cmd_switch:
             self.last_cmds.push(count_defects)
     else:
         cv2.putText(img_src, 'No finger detect!', (50, 50), cv2.FONT_HERSHEY_TRIPLEX, 2, (0, 0, 255), 2)
         if self.cmd_switch:
             self.last_cmds.push(count_defects)  # no finger detect or wrong gesture
开发者ID:RobinCPC,项目名称:CE264-Computer_Vision,代码行数:53,代码来源:gesture_hci.py


示例10: episode_theatre

def episode_theatre(endoscopist, nurse, clips, varix_lot):
    pya.hotkey('alt', 'n')
    pya.typewrite(['left'] * 2)
#    if not pya.pixelMatchesColor(1100, 100, (240, 240, 240)):
#        pya.hotkey('ctrl', 'f1')
#        time.sleep(0.5)
    user = os.getenv('USERNAME')
    doc_coord = coords.get(user, ((100, 155), (100, 360)))[0]

    pya.moveTo(doc_coord)
    pya.click()
    pya.press('tab')
    doc_test = pyperclip.copy('empty')
    pya.hotkey('ctrl', 'c')
    doc_test = pyperclip.paste()
    if doc_test == 'Endoscopist':
        pya.press('tab')
        pya.typewrite(['enter'] * 2)
        pya.moveRel(400, 0)
        pya.click()
        pya.typewrite(['tab'] * 2)
        pya.typewrite(['enter'] * 2)

    pya.moveTo(doc_coord)
    pya.click()
    pya.typewrite(endoscopist)
    pya.typewrite(['enter', 'e', 'enter'])
    pya.moveRel(400, 0)
    pya.click()
    pya.typewrite(nurse)
    pya.typewrite(['enter', 'e', 'enter'])
    if clips != 0 or varix_lot:
        pros_coord = coords.get(user, ((100, 155), (100, 360)))[1]
        pya.moveTo(pros_coord)
        pya.click()
        if varix_lot:
            pyperclip.copy('Boston Scientific Speedband Superview Super 7')
            pya.hotkey('ctrl', 'v')
            pya.press('enter')
            time.sleep(0.5)
            pyperclip.copy(varix_lot)
            pya.hotkey('ctrl', 'v')
            pya.press('enter')
            pya.typewrite(['tab'] * 2)
        if clips != 0:
            pyperclip.copy('M00521230')
            for i in range(clips):
                pya.typewrite(['b', 'enter'])
                time.sleep(0.5)
                pya.hotkey('ctrl', 'v')
                pya.press('enter')
                pya.typewrite(['tab'] * 2)
开发者ID:varnell-holdings,项目名称:new_billing,代码行数:52,代码来源:watcher.py


示例11: reset_ui_field_on_android

def reset_ui_field_on_android():
    # select all texts in the UI field
    pyautogui.mouseDown();
    time.sleep(2)
    pyautogui.mouseUp()
    # reset the UI field
    pyautogui.press("backspace")
    pyautogui.press("del")
    pyautogui.press("delete")
    # unfocus the UI field
    pyautogui.moveRel(-150, 0, duration)
    pyautogui.click()
    time.sleep(1)
开发者ID:g-sari,项目名称:py-mario-ai,代码行数:13,代码来源:utils.py


示例12: test_pause

    def test_pause(self):
        oldValue = pyautogui.PAUSE

        startTime = time.time()
        pyautogui.PAUSE = 0.35 # there should be a 0.35 second pause after each call
        pyautogui.moveTo(0, 0)
        pyautogui.moveRel(0,1)
        pyautogui.moveTo(0, 0)

        elapsed = time.time() - startTime
        self.assertTrue(1.0 < elapsed <  1.1, 'Took %s seconds, expected 1.0 < 1.1 seconds.' % (elapsed))

        pyautogui.PAUSE = oldValue # restore the old PAUSE value
开发者ID:christophervalles,项目名称:pyautogui,代码行数:13,代码来源:basicTests.py


示例13: address_scrape

def address_scrape():
    dob = pyperclip.copy('na')
    pya.moveTo(600, 175, duration=0.1)
    pya.click(button='right')
    pya.moveRel(55, 65)
    pya.click()
    dob = pyperclip.paste()
    
    street = pyperclip.copy('na')
    pya.moveTo(500, 240, duration=0.1)
    pya.click(button='right')
    pya.moveRel(55, 65)
    pya.click()
    street = pyperclip.paste()
    
    suburb = pyperclip.copy('na')
    pya.moveTo(330, 285, duration=0.1)
    pya.click(button='right')
    pya.moveRel(55, 65)
    pya.click()
    suburb = pyperclip.paste()
    
    postcode = pyperclip.copy('na')
    pya.moveTo(474, 285, duration=0.1)
    pya.dragTo(450, 285, duration=0.1)
    pya.moveTo(474, 285, duration=0.1)
    pya.click(button='right')
    pya.moveRel(55, 65)
    pya.click()
    postcode = pyperclip.paste()

    address = street + ' ' + suburb + ' ' + postcode

    return (address, dob)
开发者ID:varnell-holdings,项目名称:new_billing,代码行数:34,代码来源:login_and_run.py


示例14: example

def example():
    screenWidth, screenHeight = pag.size()
    currentMouseX, currentMouseY = pag.position()
    pag.moveTo(500, 550)
    pag.click()
    pag.moveRel(None, 10)  # move mouse 10 pixels down
    pag.doubleClick()
    # pag.moveTo(500, 500, duration=2, tween=pyautogui.tweens.easeInOutQuad)  # use tweening/easing function to move mouse over 2 seconds.
    pag.typewrite('Hello world!', interval=0.25)  # type with quarter-second pause in between each key
    pag.press('esc')
    pag.keyDown('shift')
    pag.press(['left', 'left', 'left', 'left', 'left', 'left'])
    pag.keyUp('shift')
    pag.hotkey('ctrl', 'c')
    delta_y = 50
开发者ID:Rockyzsu,项目名称:base_function,代码行数:15,代码来源:pyautogui_mouse_simulation.py


示例15: test_moveRelWithTween

    def test_moveRelWithTween(self):
        # NOTE - The user moving the mouse during this test will cause it to fail.
        DEST = 200, 200

        def resetMouse():
            # Set up mouse
            pyautogui.moveTo(100, 100)
            mousepos = pyautogui.position()
            self.assertTrue(mousepos == (100, 100), 'Mouse could not be reset to (1, 1). mousepos set to %s' % (mousepos,))

        for tweenName, tweenFunc in TestGeneral.TWEENS.items():
            resetMouse()
            pyautogui.moveRel(100, 100, duration=pyautogui.MINIMUM_DURATION * 2, tween=tweenFunc)
            mousepos = pyautogui.position()
            self.assertTrue(mousepos == DEST, '%s tween move failed. mousepos set to %s instead of %s' % (tweenName, mousepos, DEST))
开发者ID:Harendra91,项目名称:pyautogui,代码行数:15,代码来源:basicTests.py


示例16: auto_mouse

def auto_mouse():
	auto.moveTo(450,450)
	pos = auto.position()

	auto.moveRel(-200,-200)
	pos2  = auto.position()
	for i in range(100 ):
		try:
			auto.moveTo(pos, duration = 1, tween = auto.easeInCubic)
			auto.click()
			auto.moveTo(pos, duration = 1)
			auto.click()
			auto.moveTo(pos2,duration = 1, tween = auto.easeInQuad)
		except:
			sys.exit()
开发者ID:arhik,项目名称:NuLocale,代码行数:15,代码来源:mouse_automation.py


示例17: episode_theatre

def episode_theatre(endoscopist, nurse, clips, varix_lot):
    pya.hotkey('alt', 'n')
    pya.typewrite(['left'] * 2, interval=0.1)

    doc_coord = (100, 155)

    pya.moveTo(doc_coord)
    pya.click()
    pya.press('tab')
    doc_test = pyperclip.copy('empty')
    pya.hotkey('ctrl', 'c')
    doc_test = pyperclip.paste()
    if doc_test == 'Endoscopist':
        pya.press('tab')
        pya.typewrite(['enter'] * 2, interval=0.1)
        pya.moveRel(400, 0)
        pya.click()
        pya.typewrite(['tab'] * 2, interval=0.1)
        pya.typewrite(['enter'] * 2, interval=0.1)

    pya.moveTo(doc_coord)
    pya.click()
    pya.typewrite(endoscopist)
    pya.typewrite(['enter', 'e', 'enter'], interval=0.1)
    pya.moveRel(400, 0)
    pya.click()
    pya.typewrite(nurse)
    pya.typewrite(['enter', 'e', 'enter'], interval=0.1)
    if clips != 0 or varix_lot:
        pya.moveTo(100, 360)
        pya.click()
        if varix_lot:
            pyperclip.copy('Boston Scientific Speedband Superview Super 7')
            pya.hotkey('ctrl', 'v')
            pya.press('enter')
            time.sleep(0.5)
            pyperclip.copy(varix_lot)
            pya.hotkey('ctrl', 'v')
            pya.press('enter')
            pya.typewrite(['tab'] * 2, interval=0.1)
        if clips != 0:
            pyperclip.copy('M00521230')
            for i in range(clips):
                pya.typewrite(['b', 'enter'], interval=0.2)
                time.sleep(0.5)
                pya.hotkey('ctrl', 'v')
                pya.press('enter')
                pya.typewrite(['tab'] * 2, interval=0.1)
开发者ID:varnell-holdings,项目名称:new_billing,代码行数:48,代码来源:login_and_run.py


示例18: test_moveRelWithTween

    def test_moveRelWithTween(self):
        origin = self.center - P(100, 100)
        delta = P(200, 200)
        destination = origin + delta

        def resetMouse():
            pyautogui.moveTo(*origin)
            mousepos = P(*pyautogui.position())
            self.assertEqual(mousepos, origin)

        for tweenName in self.TWEENS:
            tweenFunc = getattr(pyautogui, tweenName)
            resetMouse()
            pyautogui.moveRel(delta.x, delta.y, duration=pyautogui.MINIMUM_DURATION * 2, tween=tweenFunc)
            mousepos = P(*pyautogui.position())
            self.assertEqual(mousepos, destination, '%s tween move failed. mousepos set to %s instead of %s' % (tweenName, mousepos, destination))
开发者ID:csampaio,项目名称:screen2text,代码行数:16,代码来源:autoguitest.py


示例19: moveInSquareRelative

def moveInSquareRelative():
    while True:
        print("Moving mouse again")

        for i in range(10):
            pyautogui.moveRel(100, 0, duration=0.25)
            pyautogui.moveRel(0, 100, duration=0.25)
            pyautogui.moveRel(-100, 0, duration=0.25)
            pyautogui.moveRel(0, -100, duration=0.25)
开发者ID:JSONMartin,项目名称:codingChallenges,代码行数:9,代码来源:ch__18__gui_automation.py


示例20: readAcc

    def readAcc(self):
        self.wii.rpt_mode = cwiid.RPT_BTN | cwiid.RPT_ACC
        wiiX = self.wii.state['acc'][cwiid.X] # '-' < 120, '+' > 120
        wiiY = self.wii.state['acc'][cwiid.Y]
        print(wiiX, wiiY)
        if wiiX+wiiY != 0:
            pyautogui.moveRel(wiiX - 120, wiiY - 120)

        try:
            check = (self.wii.state['buttons'] - cwiid.BTN_HOME)
            if check == 0: # home button still pressed
                self.after(20, self.readAcc)
            else:
                self.after(50, self.readWiiButtonsA)

        except:
            print("readAcc: Error") # probably caused by lost connection
开发者ID:daisyfox,项目名称:PyGrbl-WiP,代码行数:17,代码来源:wiimote_app.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyautogui.moveTo函数代码示例发布时间:2022-05-25
下一篇:
Python pyautogui.locateOnScreen函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap