本文整理汇总了Python中pyautogui.moveTo函数的典型用法代码示例。如果您正苦于以下问题:Python moveTo函数的具体用法?Python moveTo怎么用?Python moveTo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了moveTo函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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
示例2: 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
示例3: findTarget
def findTarget(img):
template_tg = cv2.imread('template_target2.png', 0)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
ret,th1 = cv2.threshold(gray,253,255,cv2.THRESH_TOZERO_INV)
ret,th3 = cv2.threshold(th1,251,255,cv2.THRESH_BINARY)
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (20, 15))
closed = cv2.morphologyEx(th3, cv2.MORPH_CLOSE, kernel)
closed = cv2.erode(closed, None, iterations = 3)
closed = cv2.dilate(closed, None, iterations = 2)
(cnts, hierarchy) = cv2.findContours(closed,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
approxes = []
hulls = []
for cnt in cnts:
approxes.append(cv2.approxPolyDP(cnt,0.01*cv2.arcLength(cnt,True),True))
hulls.append(cv2.convexHull(cnt))
left = list(cnt[cnt[:,:,0].argmin()][0])
right = list(cnt[cnt[:,:,0].argmax()][0])
print 'left x' + str(left[0])+ 'y '+ str(left[1])
print 'right x' + str(right[0])+ 'y '+ str(right[1])
center = round((right[0]+left[0])/2)
center = int(center)
moveMouse(center-10,left[1]+70)
if (findFromTargeted(template_tg, left, right)):
autoit.mouse_click('left', center-10, left[1]+70)
return True
pyautogui.moveTo(center,left[1]+70)
moveMouse(center,left[1]+70)
if (findFromTargeted(template_tg, left, right)):
autoit.mouse_click('left', center+10, left[1]+70)
return True
开发者ID:oyajiro,项目名称:l2bot,代码行数:31,代码来源:ocr.py
示例4: moveNClickIfFindIt
def moveNClickIfFindIt (**options):
displayMagnification = 2 if sysvar_ratina == True else 1
pyautogui.moveTo((options.get('top')/displayMagnification) + (options.get('width')/(displayMagnification*2)),
(options.get('left')/displayMagnification) + (options.get('height')/(displayMagnification*2)), 2)
pyautogui.click()
pyautogui.moveTo(10, 10)
开发者ID:mtsukuda,项目名称:bitrunner,代码行数:7,代码来源:bitrunner.py
示例5: 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
示例6: buscar_campo_id
def buscar_campo_id():
msg = ''
pyautogui.PAUSE = 0.5
pyautogui.FAILSAFE = False
pyperclip.copy('')
dondeEstaElCampoID = pyautogui.locateOnScreen('operator-id-field.png')
if dondeEstaElCampoID is None:
msg = 'El campo de OPERATOR-ID no fue encontrado'
return (False, msg)
else:
campoIDPos = list(dondeEstaElCampoID)
#print campoIDPos
centrocampoID = pyautogui.center(campoIDPos)
#print centrocampoID
pyautogui.moveTo(centrocampoID)
pyautogui.click(None,None,2)
pyautogui.typewrite('operador1')
pyautogui.press('enter')
pyautogui.press('enter')
pyautogui.press('enter')
return (True, msg)
开发者ID:josem-m,项目名称:dena,代码行数:27,代码来源:main_find_pass-oct-21-15-original.py
示例7: enterTimetableCalculator
def enterTimetableCalculator():
enterPlanningOffice()
#move to Timetable Calculator
pyautogui.moveTo(1280, 386)
click(1)
delay(0.5)
return
开发者ID:4linu,项目名称:public_scripts,代码行数:7,代码来源:schedule_pax_v3.1_home.py
示例8: selectTimetableCalculatorBestRoute
def selectTimetableCalculatorBestRoute():
pyautogui.moveTo(1003, 673)
click(0.3)
delay(0.3)
click(0.2)
delay(0.5)
return
开发者ID:4linu,项目名称:public_scripts,代码行数:7,代码来源:schedule_pax_v3.1_home.py
示例9: enterPlanningOffice
def enterPlanningOffice():
removeInactivityScreen()
#move to Planning Office
pyautogui.moveTo(1110, 1000)
click()
delay(1)
return
开发者ID:4linu,项目名称:public_scripts,代码行数:7,代码来源:schedule_pax_v3.1_home.py
示例10: buscar_campo_serial
def buscar_campo_serial(serial_number):
msg = ''
pyautogui.PAUSE = 0.5
pyautogui.FAILSAFE = False
pyperclip.copy('')
dondeEstaElCampoSerial = pyautogui.locateOnScreen('operator-id-field.png')
if dondeEstaElCampoSerial is None:
msg = 'El campo de SERIAL NUMBER no fue encontrado'
return (False, msg)
else:
campoSerialPos = list(dondeEstaElCampoSerial)
#print campoSerialPos
centrocampoSerial = pyautogui.center(campoSerialPos)
#print centrocampoSerial
pyautogui.moveTo(centrocampoSerial)
pyautogui.click(None,None,2)
#pyautogui.typewrite('C3WB4E768226230')
pyautogui.typewrite(serial_number)
pyautogui.press('enter')
#pyautogui.press('enter')
#pyautogui.press('enter')
return (True, msg)
开发者ID:josem-m,项目名称:dena,代码行数:26,代码来源:main_find_pass-oct-21-15-original.py
示例11: test_moveRel
def test_moveRel(self):
# start at the center
desired = self.center
pyautogui.moveTo(*desired)
mousepos = P(*pyautogui.position())
self.assertEqual(mousepos, desired)
# move down and right
desired += P(42, 42)
pyautogui.moveRel(42, 42)
mousepos = P(*pyautogui.position())
self.assertEqual(mousepos, desired)
# move up and left
desired -= P(42, 42)
pyautogui.moveRel(-42, -42)
mousepos = P(*pyautogui.position())
self.assertEqual(mousepos, desired)
# move right
desired += P(42, 0)
pyautogui.moveRel(42, None)
mousepos = P(*pyautogui.position())
self.assertEqual(mousepos, desired)
# move down
desired += P(0, 42)
pyautogui.moveRel(None, 42)
mousepos = P(*pyautogui.position())
self.assertEqual(mousepos, desired)
# move left
desired += P(-42, 0)
pyautogui.moveRel(-42, None)
mousepos = P(*pyautogui.position())
self.assertEqual(mousepos, desired)
# move up
desired += P(0, -42)
pyautogui.moveRel(None, -42)
mousepos = P(*pyautogui.position())
self.assertEqual(mousepos, desired)
# Passing a list instead of separate x and y.
desired += P(42, 42)
pyautogui.moveRel([42, 42])
mousepos = P(*pyautogui.position())
self.assertEqual(mousepos, desired)
# Passing a tuple instead of separate x and y.
desired -= P(42, 42)
pyautogui.moveRel((-42, -42))
mousepos = P(*pyautogui.position())
self.assertEqual(mousepos, desired)
# Passing a sequence-like object instead of separate x and y.
desired += P(42, 42)
pyautogui.moveRel(P(42, 42))
mousepos = P(*pyautogui.position())
self.assertEqual(mousepos, desired)
开发者ID:csampaio,项目名称:screen2text,代码行数:60,代码来源:autoguitest.py
示例12: setUp
def setUp(self):
self.oldFailsafeSetting = pyautogui.FAILSAFE
self.center = P(*pyautogui.size()) // 2
pyautogui.FAILSAFE = False
pyautogui.moveTo(*self.center) # make sure failsafe isn't triggered during this test
pyautogui.FAILSAFE = True
开发者ID:csampaio,项目名称:screen2text,代码行数:7,代码来源:autoguitest.py
示例13: onscreen_keyboard_input
def onscreen_keyboard_input(keyboard,input_str,sleep_time =0.5):
try:
pyautogui.moveTo(keyboard_in["begin1"])
for i in list(input_str):
if keyboard.has_key(i):
pyautogui.click(keyboard[i])
time.sleep(sleep_time)
elif i.isupper():
i = i.lower()
if keyboard.has_key(i):
#pyautogui.click(keyboard_in["begin1"])
pyautogui.click(keyboard["left_shift"])
#pyautogui.click(keyboard_in["begin1"])
pyautogui.click(keyboard[i])
#pyautogui.click(keyboard_in["begin1"])
time.sleep(sleep_time)
else:
#pyautogui.click(keyboard_in["begin1"])
pyautogui.click(keyboard["left_shift"])
#pyautogui.click(keyboard_in["begin1"])
pyautogui.click(keyboard[shift_keyboard[i]])
#pyautogui.click(keyboard_in["begin1"])
time.sleep(sleep_time)
#except:
except Exception,e:
print("have issue. exit input string")
msg = "onscreen_keyboard_input funcation:" + e
print time.ctime(),msg
logging.info(msg)
开发者ID:yhs666,项目名称:webRdp,代码行数:31,代码来源:keep_jumpbox.py
示例14: clickAndReturnMouseCoords
def clickAndReturnMouseCoords(coords):
orig_x,orig_y = pyautogui.position()
pyautogui.moveTo(coords[0],coords[1])
pyautogui.click()
logging.info('CLICK')
pyautogui.moveTo(orig_x, orig_y)
return
开发者ID:starcraft04,项目名称:swauto,代码行数:7,代码来源:functions_opencv.py
示例15: drag_to
def drag_to(self, name, loader=_imageLoader, offset=(0, 0)):
if GameStatus().game_stage == GameStage.Stopped:
return
self.log('try drag' + name)
p = loader.get(name)
max_val = 0
x, y = 0, 0
while max_val < 0.8:
if GameStatus().game_stage == GameStage.Stopped:
return
self.capture()
res = cv2.matchTemplate(self.screen, p, cv2.TM_CCOEFF_NORMED)
min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
self.log(name + ' ' + str(max_val))
x, y = max_loc
time.sleep(self._delay)
m, n, q = p.shape
x += n / 2
y += m / 2
pyautogui.moveTo(x, y, 0)
pyautogui.dragTo(0, 200)
开发者ID:lamaaa,项目名称:yinyangshi,代码行数:25,代码来源:Screen.py
示例16: clickAndReturnMouse
def clickAndReturnMouse(img):
orig_x,orig_y = pyautogui.position()
pyautogui.moveTo(img['points'][0]['center'][0],img['points'][0]['center'][1])
pyautogui.click()
logging.info('CLICK')
pyautogui.moveTo(orig_x, orig_y)
return
开发者ID:starcraft04,项目名称:swauto,代码行数:7,代码来源:functions_opencv.py
示例17: clickAndReturnMouse_point
def clickAndReturnMouse_point(point):
orig_x,orig_y = pyautogui.position()
pyautogui.moveTo(point['center'][0],point['center'][1])
pyautogui.click()
logging.info('CLICK')
pyautogui.moveTo(orig_x, orig_y)
return
开发者ID:starcraft04,项目名称:swauto,代码行数:7,代码来源:functions_opencv.py
示例18: attack
def attack(): # 使用match修改
global AttackPos
sleep(2)
p.click()
# sleep(0.001)
p.moveTo(AttackPos[0], AttackPos[1])
p.click(clicks=50)
开发者ID:qzane,项目名称:wanga.me,代码行数:7,代码来源:main.py
示例19: cut
def cut(link, FolderName):
global UserName
global Password
global WaitTime
global ChromiumBinary
global UserNameLocation
global PasswordLocation
global PrepdButtonLocation
global FolderSelectLocation
global CatchButtonLocation
global FirstBool
print "Link: " + link
print "Folder Name: " + FolderName + "\n"
Popen([ChromiumBinary, "--incognito", link])
print "went to rss link"
time.sleep(WaitTime)
pyautogui.moveTo(PrepdButtonLocation[0], PrepdButtonLocation[1])
pyautogui.click()
print "clicked on prepd button"
time.sleep(WaitTime)
if FirstBool == True:
#login
time.sleep(WaitTime)
pyautogui.moveTo(PasswordLocation[0], PasswordLocation[1])
pyautogui.click()
pyautogui.typewrite(Password, interval=0.05)
print "typed password"
pyautogui.moveTo(UserNameLocation[0], UserNameLocation[1])
pyautogui.click()
pyautogui.typewrite(UserName, interval=0.05)
print "typed username"
pyautogui.press('enter')
print "logged in"
time.sleep(WaitTime)
pyautogui.moveTo(FolderSelectLocation[0], FolderSelectLocation[1])
pyautogui.click()
print "clicked on folder selection"
pyautogui.typewrite(FolderName, interval=0.05)
pyautogui.press('enter')
print "typed into folder selection"
pyautogui.moveTo(CatchButtonLocation[0], CatchButtonLocation[1])
pyautogui.click()
time.sleep(WaitTime)
print "caught article"
pyautogui.press("esc")
pyautogui.hotkey('ctrl', 'w')
print "closed tab\n"
开发者ID:isaaclo123,项目名称:prepdbot_server,代码行数:60,代码来源:prepdbot_client.py
示例20: move_to
def move_to(self, *coordinates):
'''Moves the mouse pointer to an absolute coordinates.
``coordinates`` can either be a Python sequence type with two values
(eg. ``(x, y)``) or separate values ``x`` and ``y``:
| Move To | 25 | 150 | |
| @{coordinates}= | Create List | 25 | 150 |
| Move To | ${coordinates} | | |
| ${coords}= | Evaluate | (25, 150) | |
| Move To | ${coords} | | |
X grows from left to right and Y grows from top to bottom, which means
that top left corner of the screen is (0, 0)
'''
if len(coordinates) > 2 or (len(coordinates) == 1 and
type(coordinates[0]) not in (list, tuple)):
raise MouseException('Invalid number of coordinates. Please give '
'either (x, y) or x, y.')
if len(coordinates) == 2:
coordinates = (coordinates[0], coordinates[1])
else:
coordinates = coordinates[0]
try:
coordinates = [int(coord) for coord in coordinates]
except ValueError:
raise MouseException('Coordinates %s are not integers' %
(coordinates,))
ag.moveTo(*coordinates)
开发者ID:Eficode,项目名称:robotframework-imagehorizonlibrary,代码行数:30,代码来源:_mouse.py
注:本文中的pyautogui.moveTo函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论