本文整理汇总了Python中pyautogui.moveRel函数的典型用法代码示例。如果您正苦于以下问题:Python moveRel函数的具体用法?Python moveRel怎么用?Python moveRel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了moveRel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例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)
示例3: main
def main():
while True:
position = pyautogui.position()
time.sleep(60)
if position == pyautogui.position():
pyautogui.moveRel(0,-1)
pyautogui.moveRel(0,1)
示例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
示例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)
示例6: test
def test():
time.sleep(1)
pyautogui.moveRel(1,1)
#time.sleep(1)
#pyautogui.click()
#time.sleep(1)
#pyautogui.mouseDown()
time.sleep(1)
'''
示例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")
示例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)
示例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
示例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)
示例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)
示例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
示例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)
示例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
示例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))