本文整理汇总了Python中pyautogui.typewrite函数的典型用法代码示例。如果您正苦于以下问题:Python typewrite函数的具体用法?Python typewrite怎么用?Python typewrite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了typewrite函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: resetKeysPressed
def resetKeysPressed(self, keysPressed="", cancelKeyStrokes=False):
if cancelKeyStrokes:
backspaces = []
for x in range(0, len(self.keysPressed)):
backspaces.append("backspace")
pyautogui.typewrite(backspaces)
self.keysPressed = keysPressed
示例2: 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')
示例3: 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: 书籍列表已被添加到屏幕上的豆列中.'
示例4: 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)
示例5: fillTown
def fillTown(town):
pyautogui.typewrite(town)
time.sleep(0.7)
pyautogui.hotkey('down')
pyautogui.hotkey('down')
pyautogui.hotkey('tab')
pyautogui.hotkey('tab')
示例6: 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
示例7: main
def main(rfid_reader = default_rfid_reader_port):
print "Connecting to Sparkfun RFID reader on port ", rfid_reader
try:
ser = serial.Serial(rfid_reader, timeout=1) # connect to the rfid reader
print "Successfully connected to RFID reader on ", rfid_reader
rfid_reader_opened = 1
except:
print "Failed to connect to RFID reader on port ", rfid_reader
rfid_reader_opened = 0
# if the RFID reader was successfully connected, start reading and processing tags
if rfid_reader_opened:
while 1: # loop forever
ser.flushInput() # flush any extra data from the serial port
rfid_data = ser.readline().strip() # read the rfid data
# if data has been received
if len(rfid_data) > 0:
rfid_data = rfid_data[1:13] # strip off all data but the tag number
print "Tag data:", rfid_data # print the tag number to console
pyautogui.typewrite(rfid_data) # auto-type the tag number to focus window
pyautogui.typewrite(['tab']) # auto-type a tab to the focus window to move to the next field
示例8: 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()
示例9: episode_gp
def episode_gp():
pya.hotkey('alt', 'a')
pya.typewrite(['tab'] * 4, interval=0.1)
gp = pyperclip.copy('empty')
pya.hotkey('ctrl', 'c')
gp = pyperclip.paste()
return gp
示例10: 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)
示例11: printscores
def printscores():
#note only works in Firefox
#selects all of the scores
try:
selectall = WebDriverWait(browser, 3).until(EC.presence_of_element_located((By.ID, "m_m_mid_mid_ReportByDate2_rptDataView_ctl00_ctl02_ctl01_GridClientSelectColumnSelectCheckBox")))
selectall.click()
except:
pass
#exports to pdf
export = WebDriverWait(browser, 2).until(EC.presence_of_element_located((By.ID, "m_m_top_wel_imgBtnExport")))
export.click()
logging.debug("Still working")
#chooses pdf from the popup
browser.switch_to.frame('rwPreview')
choosepdf = WebDriverWait(browser, 2).until(EC.presence_of_element_located((By.ID, "radio4")))
choosepdf.click()
donebutton = browser.find_element_by_id('imgBtnDone')
donebutton.click()
#todo let it continue when the pdf downloads and break if it does not download
time.sleep(5)
pyautogui.press('enter')
time.sleep(2)
pyautogui.hotkey('ctrl', 'j')
time.sleep(2)
pyautogui.press('enter')
time.sleep(4)
pyautogui.hotkey('ctrl', 'p')
time.sleep(4)
pyautogui.press('enter')
time.sleep(4)
pyautogui.typewrite(printcode)
pyautogui.press('enter')
示例12: key
def key(self,evt):
'See if key press is used to select an element or to close window'
if not self.drawn:
return
char = evt.char
if char in '1 2 3 4 5 6 7 8 9 0'.split(' '):
if self.selecting:
dprint('selecting because copied')
dprint(self.recent_value)
self.dict[int(char)] = self.recent_value
self.drawn, self.selecting = False, False
self.root.withdraw()
self.update_listbox()
return
self.drawn, self.selecting = False, False
#Close window
self.root.withdraw()
dprint(char)
text = self.dict[int(char)]
#Type selected text
pyautogui.typewrite(text)
elif evt.keysym == 'space':
return
else:
return
dprint(char)
dprint(evt.keysym)
dprint('bye')
self.root.withdraw()
self.drawn, self.selecting = False,False
return
示例13: 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)
示例14: key
def key(s):
if 'enter' in s:
pyautogui.press('enter')
elif 'back' in s:
pyautogui.press('back')
else:
pyautogui.typewrite(s)
示例15: bet
def bet(self, n):
v = self.LOCATIONS['textBar']
gui.moveTo(np.random.randint(v[0][0] + self.x, v[1][0] + self.x),
np.random.randint(v[0][1] + self.y, v[1][1] + self.y),
duration = .5)
gui.click()
gui.typewrite(str(n), interval=0.25)
gui.press('enter')