“pyautogui” Réponses codées

pyautogui

>>> pyautogui.hotkey('ctrl', 'c')  # ctrl-c to copy
>>> pyautogui.hotkey('ctrl', 'v')  # ctrl-v to paste
Testy Tuatara

pyautogui

>>> import pyautogui
>>> pyautogui.PAUSE = 2.5
Testy Tuatara

pyautogui

>>> pyautogui.keyDown(key_name)
>>> pyautogui.keyUp(key_name)
Testy Tuatara

pyautogui

>>> pyautogui.position()  # current mouse x and y
(968, 56)
>>> pyautogui.size()  # current screen resolution width and height
(1920, 1080)
>>> pyautogui.onScreen(x, y)  # True if x & y are within the screen.
True
Testy Tuatara

pyautogui

>>> pyautogui.typewrite(['a', 'b', 'c', 'left', 'backspace', 'enter', 'f1'], interval=secs_between_keys)
Testy Tuatara

pyautogui

>>> import pyautogui
>>> pyautogui.FAILSAFE = True
Testy Tuatara

pyautogui

>>> pyautogui.alert('This displays some text with an OK button.')
>>> pyautogui.confirm('This displays text and has an OK and Cancel button.')
'OK'
>>> pyautogui.prompt('This lets the user type in a string and press OK.')
'This is what I typed in.'
Testy Tuatara

pyautogui

>>> pyautogui.click(x=moveToX, y=moveToY, clicks=num_of_clicks, interval=secs_between_clicks, button='left')
Testy Tuatara

pyautogui

>>> pyautogui.locateOnScreen('looksLikeThis.png')  # returns (left, top, width, height) of first place it is found
(863, 417, 70, 13)
Testy Tuatara

pyautogui

>>> list(pyautogui.locateAllOnScreen('looksLikeThis.png'))
[(863, 117, 70, 13), (623, 137, 70, 13), (853, 577, 70, 13), (883, 617, 70, 13), (973, 657, 70, 13), (933, 877, 70, 13)]
Testy Tuatara

Réponses similaires à “pyautogui”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code