本文整理汇总了Python中pyautogui.click函数的典型用法代码示例。如果您正苦于以下问题:Python click函数的具体用法?Python click怎么用?Python click使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了click函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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
示例2: 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
示例3: 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"
示例4: 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)
示例5: 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)
示例6: GetShitDone
def GetShitDone():
"Tis function looks after the moon and get shit done"
pos = pyautogui.locateOnScreen('moon.png')
if (pos != None):
x, y = pyautogui.center(pos)
print(time.ctime(), 'Found moon @ x:', x , ' y:', y)
pyautogui.click(x, y+75)
time.sleep( 1.5 )
pos = pyautogui.locateOnScreen('horn.png')
if (pos != None):
x, y = pyautogui.center(pos)
print(time.ctime(), 'make horn @ x:', x , ' y:', y)
pyautogui.click(x, y+75)
return
pos = pyautogui.locateOnScreen('pot.png')
if (pos != None):
x, y = pyautogui.center(pos)
print(time.ctime(), 'make pot @ x:', x , ' y:', y)
pyautogui.click(x, y+75)
return
pos = pyautogui.locateOnScreen('kohl.png')
if (pos != None):
x, y = pyautogui.center(pos)
print(time.ctime(), 'make kohl @ x:', x , ' y:', y)
pyautogui.click(x, y)
return
pos = pyautogui.locateOnScreen('close.png')
if (pos != None):
x, y = pyautogui.center(pos)
print(time.ctime(), 'exit @ x:', x , ' y:', y)
pyautogui.click(x, y)
return
return
示例7: output_doulist
def output_doulist(input_list):
# 1. find button and change focus in browser
button_pos = pyautogui.locateOnScreen('output/add_button.png')
if not button_pos:
# no valid button
print '没有找到有效的"添加内容"按钮, 请检查后再次导出.'
return
elif len(list(pyautogui.locateAllOnScreen('output/add_button.png'))) > 1:
# more than one valid button
print '屏幕中有多个有效的"添加内容"按钮, 请检查后再次导出.'
return
else:
# valid input: only one button available
# remaining issue: the picture is not alwas found in screen...that's strange.
pyautogui.click(button_pos)
for i in input_list:
# 2. press button
time.sleep(4)
pyautogui.click(button_pos)
# 3. write link
time.sleep(2)
pyautogui.typewrite(i)
pyautogui.press('enter')
# 4. add to Doulist
time.sleep(2)
pyautogui.press('tab')
pyautogui.press('tab')
pyautogui.press('tab')
pyautogui.press('enter')
print 'iDoulist: 书籍列表已被添加到屏幕上的豆列中.'
示例8: 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)
示例9: test_maximize_restore
def test_maximize_restore(cartavisInstance, cleanSlate):
"""
Test that a window can be maximized and then restored to
its original position
"""
# Find and select the animation window
animWindow = ImageUtil.locateCenterOnScreen('test_images/animWindow.png')
assert animWindow != None
pyautogui.doubleClick( x=animWindow[0], y=animWindow[1])
time.sleep(2)
# Click the window button
windowButton = ImageUtil.locateCenterOnScreen('test_images/windowButton.png')
assert windowButton != None
pyautogui.click( x=windowButton[0], y=windowButton[1])
# Look for the maximize button in the submenu
pyautogui.press('down')
pyautogui.press('return')
time.sleep(2)
# Verify that there is a single animator window
assert len(cartavisInstance.getAnimatorViews()) == 1
# Right click the context menu to restore a animator window
pyautogui.rightClick( x=animWindow[0], y=animWindow[1])
pyautogui.press('down')
pyautogui.press('down')
pyautogui.press('down')
pyautogui.press('right')
pyautogui.press('return')
time.sleep(2)
# Verify that there are exactly the same number of windows as there were originally and the animation window is present
assert len(cartavisInstance.getAnimatorViews()) == 1
示例10: 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
示例11: incontent_noauto
def incontent_noauto(i):
b.open(i,new=new)
time.sleep(3)
scroll_down()
time.sleep(1)
pyautogui.press('s')
time.sleep(2)
pyautogui.press('m')#mute the ad
pyautogui.press('v')#un-mute
full_screen(i)
time.sleep(1)
pyautogui.press('esc')
#pyautogui.click(810,409)
#pyautogui.click(810,409)
#pyautogui.click()
pyautogui.click()
pyautogui.press('s')
pyautogui.press('r')
click_through(i)
pyautogui.press('p')#pause the ad
time.sleep(1)
pyautogui.press('r')#resume the ad
pyautogui.click()
time.sleep(15)
scroll_up()
#os.system(bashCommand)
close_tab()
示例12: dumper
def dumper():
pya.click(100, 500)
pya.hotkey('alt', 'd')
pya.press('enter')
pya.hotkey('alt', 'd')
mrn = pyperclip.copy('empty')
pya.hotkey('ctrl', 'c')
mrn = pyperclip.paste()
print(mrn)
today_path = write_as_billed(mrn)
make_web_secretary(today_path)
with shelve.open('d:\\JOHN TILLET\\episode_data\\dumper_data.db') as s:
try:
episode = s[mrn]
except KeyError:
pya.alert('No data available')
return
episode_discharge(
episode['in_theatre'], episode['out_theatre'],
episode['anaesthetist'], episode['endoscopist'])
episode_procedures(
episode['upper'], episode['colon'],
episode['banding'], episode['asa'])
if (episode['upper'] in {'30490-00'}
or 'HALO' in episode['message']
or '32089-00' in episode['message']
or episode['colon'] in {'32093-00', '32094-00'}
or episode['banding'] in {'32153-00'}):
episode_claim()
else:
pya.hotkey('alt', 'c')
episode_theatre(episode['endoscopist'], episode['nurse'],
episode['clips'], episode['varix_lot'])
示例13: makeOrder
def makeOrder(orderType):
"""Does the mouse clicks needed to create an order.
The orderType parameter has the value of one of the ONIGIRI, GUNKAN_MAKI, CALIFORNIA_ROLL, SALMON_ROLL, SHRIMP_SUSHI, UNAGI_ROLL, DRAGON_ROLL, COMBO constants.
The INVENTORY global variable is updated in this function for orders made.
The return value is None for a successfully made order, or the string of an ingredient constant if that needed ingredient is missing."""
global ROLLING_COMPLETE, INGRED_COORDS, INVENTORY
# wait until the mat is clear. The previous order could still be there if the conveyor belt has been full or the mat is currently rolling.
while time.time() < ROLLING_COMPLETE and pyautogui.locateOnScreen(imPath('clear_mat.png'), region=(GAME_REGION[0] + 115, GAME_REGION[1] + 295, 220, 175)) is None:
time.sleep(0.1)
# check that all ingredients are available in the inventory.
for ingredient, amount in RECIPE[orderType].items():
if INVENTORY[ingredient] < amount:
logging.debug('More %s is needed to make %s.' % (ingredient, orderType))
return ingredient
# click on each of the ingredients
for ingredient, amount in RECIPE[orderType].items():
for i in range(amount):
pyautogui.click(INGRED_COORDS[ingredient], duration=0.25)
INVENTORY[ingredient] -= 1
findAndClickPlatesOnBelt() # get rid of any left over meals on the conveyor belt, which may stall this meal from being loaded on the belt
pyautogui.click(MAT_COORDS, duration=0.25) # click the rolling mat to make the order
logging.debug('Made a %s order.' % (orderType))
ROLLING_COMPLETE = time.time() + 1.5 # give the mat enough time (1.5 seconds) to finish rolling before being used again
示例14: test_animatorReverse
def test_animatorReverse(cartavisInstance, cleanSlate):
"""
Test the Animator reverse setting.
"""
i = cartavisInstance.getImageViews()
a = cartavisInstance.getAnimatorViews()
# Load an image
i[0].loadFile(os.getcwd() + '/data/N15693D.fits')
# Get the last channel value (should be the number of channels - 1)
lastChannel = i[0].getChannelCount() - 1
# Open animator settings
_openAnimatorSettings()
# Click the reverse radio button
reverseButton = ImageUtil.locateCenterOnScreen('test_images/reverseButton.png')
assert reverseButton != None
pyautogui.click( x=reverseButton[0], y=reverseButton[1])
# Set the image to the last channel value
a[0].setChannel( lastChannel )
# Click the forward animate button on the tape deck
_animateForward()
time.sleep(2)
assert a[0].getChannelIndex() < lastChannel
_stopAnimation()
# Close animator settings
_openAnimatorSettings()
示例15: test_animatorStepIncrement
def test_animatorStepIncrement(cartavisInstance, cleanSlate):
"""
Test that the Animator can be set to different step increment values.
"""
i = cartavisInstance.getImageViews()
a = cartavisInstance.getAnimatorViews()
# Load an image
i[0].loadFile(os.getcwd() + '/data/N15693D.fits')
# Open animator settings
_openAnimatorSettings()
# Find the step increment spin box and change the step increment to 2
stepIncrement = ImageUtil.locateCenterOnScreen('test_images/stepIncrement.png')
pyautogui.click(x=stepIncrement[0]+40, y=stepIncrement[1])
pyautogui.press('delete')
pyautogui.typewrite('2')
pyautougi.press('return')
# Go to the next channel value
a[0].setChannel(0)
_getNextValue()
assert a[0].getChannelIndex() == 2
# Close animator settings
_openAnimatorSettings()