3 Star 35 Fork 7

circlestar/GenshinMapAutoMarkTools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.py 2.23 KB
一键复制 编辑 原始数据 按行查看 历史
circlestarzero 提交于 2022-02-17 19:23 +08:00 . v1.2
import sys
import win32gui
import sys
import re
import os
import delete_mark
import keyboard
import win32com.client
import pythoncom
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QImage
import map_insert
import pic_locate
import delete_mark
base_dir = os.path.dirname(os.path.abspath(__file__))
app = QApplication(sys.argv)
def JudgeWindowSize(hwnd):
screen = QApplication.primaryScreen()
pix = screen.grabWindow(hwnd).toImage().convertToFormat(QImage.Format.Format_RGBA8888)
print((pix.width(),pix.height()))
if pix.width()==1920 and pix.height()==1080:
return 1
if pix.width()==1366 and pix.height()==768:
return 1
if pix.width()==1280 and pix.height()==720:
return 1
return 0
def OpenSearchBox():
st=os.system(r'python {0}\search_box.py'.format(base_dir))
def ImportConfig():
config_list=[]
with open('{0}\config.ini'.format(base_dir), 'r', encoding='UTF-8') as f:
temp=f.readlines()
print(temp)
for i in range(5):
gp=re.search(r'(:|:)\s*?(\S.*)\s*?', temp[i])
if gp==None or len(gp.groups())<2:config_list.append('')
else: config_list.append(gp.group(2))
return config_list
if __name__=='__main__':
pythoncom.CoInitialize()
shell = win32com.client.Dispatch("WScript.Shell")
shell.SendKeys('%')
hwnd = win32gui.FindWindow('UnityWndClass', None)
if JudgeWindowSize(hwnd)==0:
print('分辨率尚未适配')
else:
win32gui.SetForegroundWindow(hwnd)
config=ImportConfig()
if config[0]!='':
keyboard.add_hotkey(config[0],OpenSearchBox,suppress = False)
if config[1]!='':
keyboard.add_hotkey(config[1],delete_mark.DeleteCenterMark,(map_insert.kp2,map_insert.des2),suppress = False)
if config[2]!='':
keyboard.add_hotkey(config[2],delete_mark.DeleteMouseMark,(map_insert.kp2,map_insert.des2),suppress = False)
if config[3]!='':
keyboard.add_hotkey(config[3],delete_mark.GetMarkInfo,(hwnd,map_insert.kp2,map_insert.des2),suppress = False)
if config[4]!='':
keyboard.add_hotkey(config[4],pic_locate.DeleteAllMarks,(hwnd,),suppress = False)
keyboard.wait()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/circlestar/GenshinMapAutoMarkTools.git
git@gitee.com:circlestar/GenshinMapAutoMarkTools.git
circlestar
GenshinMapAutoMarkTools
GenshinMapAutoMarkTools
version-1.2

搜索帮助