本文整理汇总了Python中pyautogui.press函数的典型用法代码示例。如果您正苦于以下问题:Python press函数的具体用法?Python press怎么用?Python press使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了press函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: quoteOSHPark
def quoteOSHPark(self):
"""Function for navigating OSHPark's website."""
url, user, pw = self.readConfig('oshpark', 'rigid')
# Open new tab and go to URL
self.newTab()
self.driver.get(url)
# Enter login information
self.driver.find_element_by_css_selector('#user_email').send_keys(user)
self.driver.find_element_by_css_selector('#user_password').send_keys(pw)
# Click login button
self.driver.find_element_by_css_selector('.buttons > input:nth-child(1)').click()
self.driver.find_element_by_css_selector('#ember291').click()
self.driver.find_element_by_css_selector('#file_selector > input:nth-child(2)').click()
e = EWMH()
windows = e.getClientList()
for window in windows:
if e.getWmName(window) == 'File Upload':
time.sleep(0.5)
e.setActiveWindow(window)
e.display.flush()
time.sleep(0.5)
pyautogui.hotkey('ctrl', 'a')
pyautogui.press('backspace')
# '''get file location from config file'''
# pyautogui.typewrite(fileLocation)
pyautogui.press('return')
开发者ID:antonbilbaeno,项目名称:gitpcb,代码行数:30,代码来源:InstantQuote.py
示例2: chopping
def chopping():
imaging.chopping_check()
while config.check:
imaging.chopping_check()
print('Chopping...')
pyautogui.press('d')
time.sleep(.45)
开发者ID:Metal079,项目名称:GraalOnline-Olwest-WoodCutting-Bot,代码行数:7,代码来源:main.py
示例3: parse_info
def parse_info(name):
driver.find_element_by_xpath('//*[@title="Search or start new chat"]').click()
pag.typewrite(name)
pag.press('enter')
time.sleep(1)
page = driver.page_source
soup = BeautifulSoup(page, "html.parser")
x = soup.find_all("span")
numbers = []
for i in range(0,len(list(x))):
if str(x[i]).find(str(name)) == -1:
continue
else:
numbers.append(i)
del i
date = str(datetime.now())
name = re.search('>(.*)<', str(x[numbers[len(numbers)-1]])).group(1)
info = re.search('>(.*)<', str(x[numbers[len(numbers)-1]+1])).group(1)
del x
return date,name,info
开发者ID:saurabh-rao,项目名称:whatsapp-analytics,代码行数:25,代码来源:test.py
示例4: 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'])
开发者ID:varnell-holdings,项目名称:new_billing,代码行数:33,代码来源:watcher.py
示例5: 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
示例6: 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: 书籍列表已被添加到屏幕上的豆列中.'
开发者ID:chaonet,项目名称:iDoulist,代码行数:30,代码来源:function2_output.py
示例7: start_scan
def start_scan(self):
# print(self.cursor, self.color)
print('starting scan in 2')
time.sleep(2)
prev_position = [0, 0]
while True:
pyautogui.press('3')
# time.sleep(1)
color = self.color
image = img.grab()
for x in range(250, 1500, 2): # change to fishing area
for y in range(200, 650, 2):
color_now = image.getpixel((x, y))
if np.allclose(list(color_now), list(color), atol=10):
print('found color in position', x, y)
'''self.update_s2(color_now)
self.color_now = color_now
time.sleep(1)
win32api.SetCursorPos((x, y))
print('match!')
self.after(2000)'''
if abs(x - prev_position[0] >= 10) and abs(y - prev_position[2] >= 10):
prev_position[0] = x
prev_position[1] = y
win32api.SetCursorPos((x, y))
return self.wait_thread()
print('scan Finished with no match...')
开发者ID:ucshadow,项目名称:Fish_bot,代码行数:27,代码来源:even+more.py
示例8: sign_in
def sign_in(email, password):
pyautogui.typewrite(email, interval=TYPE_INTERVAL)
pyautogui.press('enter')
time.sleep(3)
pyautogui.typewrite(password, interval=TYPE_INTERVAL)
pyautogui.press('enter')
time.sleep(3)
开发者ID:pdxjohnny,项目名称:hangouts-caller,代码行数:7,代码来源:hangouts.py
示例9: 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
示例10: key
def key(s):
if 'enter' in s:
pyautogui.press('enter')
elif 'back' in s:
pyautogui.press('back')
else:
pyautogui.typewrite(s)
开发者ID:Shivakishore14,项目名称:Droidpadz,代码行数:7,代码来源:key.py
示例11: getViewsWithPytesseract
def getViewsWithPytesseract():
global latestViewCount, totalViews, nothingFoundCounter, totalRuns
while totalRuns < 10000:
try:
print("Runs: %s" % totalRuns)
totalRuns += 1
# shiftDown()
pyautogui.press('down')
time.sleep(0.5)
im = screenShot()
s = pytesseract.image_to_string(im, config='-psm 6')
print s
if "views" in s != -1:
for line in s.split("\n"):
if "views" in line:
evaluateViews(line)
elif "vlews" in s != -1:
for line in s.split("\n"):
if "vlews" in line:
evaluateViews(line)
elif "VIEWS" in s != -1:
for line in s.split("\n"):
if "vlews" in line:
evaluateViews(line)
else:
if nothingFoundCounter == 15:
saveViews(totalViews, latestViewCount)
else:
nothingFoundCounter += 1
print("Nothing found %s times" % nothingFoundCounter)
#getViewsWithPytesseract()
except Exception, e:
print ("Something went terribly wrong: %s" % str(e))
开发者ID:dennerkrans,项目名称:instagram-screenshot-views-scraper,代码行数:33,代码来源:find_views.py
示例12: startNewGame
def startNewGame(self, genome=None):
# Refresh state
logger.info('in start game 200')
logger.info(genome)
self.readGameState()
logger.info(self.gamestate)
if genome:
self.genome = genome
# If game is already over, press space
if self.gamestate == 'OVER' or not self.onGameStart:
self.event.set()
# Set start callback
self.onGameStart = True
logger.info('Trying to start')
# Press space to begin game (repetidelly)
pyautogui.press(' ')
#ThreadJob(lambda x:pyautogui.press(' '),self.event, 0.3 ).start()
# Refresh state
self.readGameState()
else:
# Wait die, and call recursive action
self.setGameEnd = 2
开发者ID:ajaiswal-ht,项目名称:imdino,代码行数:28,代码来源:game_manipulator_b.py
示例13: send_command
def send_command(self, cmd):
self.save_screenshot()
pyautogui.hotkey('ctrl', 'space')
pyautogui.typewrite(cmd)
self.save_screenshot()
pyautogui.press('enter')
pyautogui.press('escape')
开发者ID:ThierryM,项目名称:bCNC,代码行数:7,代码来源:base.py
示例14: dir_command
def dir_command(dir):
global y_pressed, dir_to_hjkl
print(y_pressed)
if y_pressed:
invoke("xdotool key ctrl+alt+{}".format(dir_to_hjkl[dir]))
else:
pyautogui.press(dir.lower())
开发者ID:olzraiti,项目名称:dotfiles,代码行数:7,代码来源:steam_custom.py
示例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()
开发者ID:daikema,项目名称:CARTAvis,代码行数:27,代码来源:test_animator.py
示例16: navigateGameWindow
def navigateGameWindow():
"""Get the initial focus on the game window and mute the game, getting
ready to play."""
# Get focus on the game by clicking the center of the game region
pyautogui.click(GAME_CENTER[0], GAME_CENTER[1], duration=1)
# Mute game (it helps too because it disables some in-game effects :-p)
pyautogui.press('m')
开发者ID:Soreine,项目名称:cardinal-bot,代码行数:8,代码来源:cardinalbot.py
示例17: shiftDown
def shiftDown():
print "\nGoing down...\n"
# counter = 0
# while counter < 6:
# #time.sleep(0.5)
# pyautogui.press('down')
# counter += 1
pyautogui.press('down')
开发者ID:dennerkrans,项目名称:instagram-screenshot-views-scraper,代码行数:8,代码来源:find_views.py
示例18: loadSymbolInChart
def loadSymbolInChart(msComponents, symbol):
pyautogui.moveTo(msComponents['symbolEntry']['x'], msComponents['symbolEntry']['y'], 0.25)
safeClick(msComponents['symbolEntry']['x'], msComponents['symbolEntry']['y'])
pyautogui.hotkey(platform.primary_key_modifier, 'a')
pyautogui.press('delete')
pyautogui.typewrite(symbol)
pyautogui.typewrite(['enter'])
wait(DELAY_CHART_LOAD)
开发者ID:hn4002,项目名称:auto-save-mscharts,代码行数:8,代码来源:main.py
示例19: run
def run(self):
while 1:
try:
data = record_keyboard_data()
pyautogui.typewrite(data)
pyautogui.press('enter')
except Exception as e:
print "Something went wrong in keyboardThread: ", e
开发者ID:gitanuj,项目名称:gesture-recog,代码行数:8,代码来源:phonehelp.py
示例20: perform_action
def perform_action(self, clazz):
if clazz == 'flip':
pyautogui.hotkey('command', 'space')
elif clazz == 'top_down':
pyautogui.press('space')
elif clazz == 'right_left':
pyautogui.press('right')
print "dummy"
开发者ID:gitanuj,项目名称:gesture-recog,代码行数:8,代码来源:phonehelp.py
注:本文中的pyautogui.press函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论