Let Python automatically manipulate the desktop or application window, click, slide the mouse, enter text, etc.
# coding=utf-8from Pymouse Import pymousefrom pykeyboard import pykeyboardimport time, Randomimport Pyautogui as PAGM = Py Mouse () K = Pykeyboard () x_dim, Y_dim = M.screen_size () # Open Browser, click Baidu Search Box M.click (282, 183) Time.sleep (0.3) # Enter keyword K.type_ String (' Cnblog ') # Enter K.tap_key (K.enter_key) # Blind inside the page while True: i = Random.uniform ( -10, ten) m.scroll (2 * I, None, None) Time.sleep (2) M.click (+ x * I, + + * i) # get mouse coordinates def GETM_XY (): try: While True: print " Press Ctrl-c to end " x, y = pag.position () # Returns the coordinates of the mouse posstr =" Position: "+ str (x). Rjust (4) + ', ' + str (y). Rju St (4) Print posstr # Printing coordinates time.sleep (1) # os.system (' cls ') # clear screen except Keyboardinterrupt: print ' end .... '
It doesn't feel any use to write it, it is purely a free egg.
Python Simulation Mouse Key