Suche…


Einführung

pyautogui ist ein Modul zur Steuerung von Maus und Tastatur. Dieses Modul wird im Wesentlichen zur Automatisierung von Mausklick- und Tastendruckaufgaben verwendet. Bei der Maus beginnen die Koordinaten des Bildschirms (0,0) in der oberen linken Ecke. Wenn Sie außer Kontrolle geraten, bewegen Sie den Mauszeiger schnell nach oben links. Die Maus und die Tastatur werden vom Python gesteuert und geben Sie an Sie zurück.

Mausfunktionen

Dies sind einige nützliche Mausfunktionen zur Steuerung der Maus.

size()           #gave you the size of the screen
position()     #return current position of mouse
moveTo(200,0,duration=1.5)     #move the cursor  to (200,0) position  with 1.5 second delay     
moveRel()          #move the cursor relative to your current position.
click(337,46)           #it will click on the position mention there
dragRel()              #it will drag the mouse relative to position
pyautogui.displayMousePosition()     #gave you the current mouse position but should be done on terminal.

Tastaturfunktionen

Dies sind einige nützliche Tastaturfunktionen zum Automatisieren des Tastendrucks.

typewrite('')    #this will type the string on the screen where current window has focused.
typewrite(['a','b','left','left','X','Y'])
pyautogui.KEYBOARD_KEYS    #get the list of all the keyboard_keys.
pyautogui.hotkey('ctrl','o')    #for the combination of keys to enter.

ScreenShot und Bilderkennung

Diese Funktion hilft Ihnen, den Screenshot aufzunehmen und das Bild mit dem Bildschirmteil abzugleichen.

.screenshot('c:\\path')        #get the screenshot.
.locateOnScreen('c:\\path')    #search that image on screen and get the coordinates for you.
locateCenterOnScreen('c:\\path')       #get the coordinate for the image on screen.


Modified text is an extract of the original Stack Overflow Documentation
Lizenziert unter CC BY-SA 3.0
Nicht angeschlossen an Stack Overflow