Python 小白求助
目前有這樣一個需求:
打開本地SVN倉庫所在路徑,右鍵點出SVN界面,選擇commit ,然后勾選ALL按鈕,點擊OK完成提交
代碼如下:
import os
import time
import pyautogui
# 自動勾選SVN提交界面的ALL選項
svnpath = 'D:\\SVN'
def autocheckall(svnpath):
result = os.system('explorer.exe /n,' + svnpath) ###使用explorer打開SVN所在目錄
time.sleep(1)
screenWidth, screenHeight = pyautogui.size() ###獲取當前解析度
pyautogui.moveTo(screenWidth / 2, screenHeight / 2) ###移動滑鼠到螢屏中間
pyautogui.rightClick() ###滑鼠右鍵點擊
time.sleep(1) ###延遲1S
curDirPath = os.path.dirname(__file__) + '\\'
posSVNcommit = pyautogui.locateCenterOnScreen(curDirPath +'pic\\SVNcommitIcon.png', grayscale=True)
###獲取commit圖示
if posSVNcommit is None:
print("未找到SVNCommit圖示")
return False
pyautogui.moveTo(posSVNcommit[0], posSVNcommit[1])
pyautogui.leftClick()
time.sleep(1)
autocheckall(svnpath)
現在的問題是,能打SVN開檔案夾,也能點擊右鍵,但是就是不能識別Commit這個按鈕圖片,
posSVNcommit = pyautogui.locateCenterOnScreen(curDirPath +'pic\\SVNcommitIcon.png', grayscale=True)
這個命令一直回傳None
請教下是什么原因啊?
代碼有沒有問題啊 ?
或者說還有其他什么實作的代碼?
真心求教,才學習python半月
uj5u.com熱心網友回復:
咋沒有大佬看呢
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/196152.html
下一篇:python 處理音頻檔案
