Python-pyautogui包-模拟鼠标点击

"""
Created on Fri Feb 17 15:08:37 2017 
 
@author: yunjinqi 
 
E-mail:[email protected] 
 
Differentiate yourself in the world from anyone else.
"""
import pyautogui
import time
screenWidth, screenHeight = pyautogui.size()
currentMouseX, currentMouseY = pyautogui.position()
time.sleep(30)
pyautogui.moveTo(279, 364)#打开品种
pyautogui.click()
time.sleep(0.5)
pyautogui.moveTo(231, 429)#选品种枸杞
pyautogui.click()
time.sleep(0.5)
pyautogui.moveTo(381, 368)#选择买卖方向
pyautogui.click()
time.sleep(0.5)
pyautogui.moveTo(342, 405)#选择卖出
pyautogui.click()
time.sleep(0.5)
pyautogui.moveTo(342, 405)#选择卖出
pyautogui.click()
time.sleep(0.5)
pyautogui.moveTo(513, 368)#选择开平仓
pyautogui.click()
time.sleep(0.5)
pyautogui.moveTo(461,405)#选择平仓
pyautogui.click()
time.sleep(0.5)
注:当我们模拟鼠标点击的时候,最关键的因素是我们要知道鼠标的位置。有一个小软件,mousexy.exe可以帮我们解决这个问题,真是太方便了.总体上使用这个包,比用pywinauto要方便很多

你可能感兴趣的:(python,Python,自动化,windows,pyautogui)