-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcheckPoints.py
49 lines (40 loc) · 1.32 KB
/
checkPoints.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import os
import importlib
import pyautogui as pi
import config
def check_package_installed(package_name):
try:
importlib.import_module(package_name)
except ImportError:
return False
else:
return True
def checkPoint():
package_name = ["fuzzywuzzy", "numpy", "cv2", "pandas", "pyautogui", "pygetwindow", "pytesseract"]
checkPass = True
for name in package_name:
if not check_package_installed(name):
print("The package", name, "is not installed.")
checkPass = False
return checkPass
def checkStructure():
path = "./imgs"
if not os.path.exists(path):
os.makedirs(path)
os.chdir(path)
for value in config.names.values:
os.makedirs(path+"/"+value)
os.chdir("..")
def screenConfig():
pi.PAUSE = 0.1
pi.FAILSAFE = False
screenSize = pi.size()
# if screenSize.height == 1600 and screenSize.width == 2560:
screenSize_str = str(screenSize.width) + "*" + str(screenSize.height) + "_" + config.language
if screenSize_str in config.location_list.keys():
config.location = config.location_list[screenSize_str]
print("分辨率检测通过")
return True
else:
print("分辨率错误")
return False