添加点击偏移 添加测试函数
This commit is contained in:
16
touch2.py
16
touch2.py
@@ -121,7 +121,7 @@ class ser(object):
|
|||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
self.togo(0,0)
|
self.togo(0,0)
|
||||||
def enter(self):
|
def enter(self):
|
||||||
self.togo(70+20,27)
|
self.togo(70+20,30)
|
||||||
self.touch()
|
self.touch()
|
||||||
def back(self):
|
def back(self):
|
||||||
self.togo(70,132)
|
self.togo(70,132)
|
||||||
@@ -138,15 +138,17 @@ class ser(object):
|
|||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
def password(self,p:str):
|
def password(self,p:str):
|
||||||
index=0
|
index=0
|
||||||
|
touch_times=0
|
||||||
p_len=len(p)
|
p_len=len(p)
|
||||||
try_times=0
|
try_times=0
|
||||||
while index<p_len:
|
while index<p_len:
|
||||||
pos=self.touch_table[p[index]]
|
pos=self.touch_table[p[index]]
|
||||||
myprint(f"点击 index={index},{p[index]}")
|
myprint(f"点击 index={index},{p[index]}")
|
||||||
self.togo(pos[0],pos[1])
|
self.togo(pos[0]+int(pow(-1,touch_times)*3),pos[1])
|
||||||
self.touch()
|
self.touch()
|
||||||
self.avoid()
|
self.avoid()
|
||||||
time.sleep(0.1) # 这里延时防止界面更新延迟导致的识别异常
|
time.sleep(0.1) # 这里延时防止界面更新延迟导致的识别异常
|
||||||
|
touch_times+=1
|
||||||
# if(find_text(identify_text(),"手机已锁定")):
|
# if(find_text(identify_text(),"手机已锁定")):
|
||||||
# if(index==5):
|
# if(index==5):
|
||||||
# myprint(f"手机锁定中,已全部输入")
|
# myprint(f"手机锁定中,已全部输入")
|
||||||
@@ -182,7 +184,17 @@ def data_get()->dict:
|
|||||||
return {"index":0}
|
return {"index":0}
|
||||||
|
|
||||||
|
|
||||||
|
def test():
|
||||||
|
identify_text()
|
||||||
|
get_scr(_ocr_pos[0],_ocr_pos[1],_ocr_pos[2],_ocr_pos[3],f"test")
|
||||||
|
find_input_count()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv)>=2 and sys.argv[1]=='test':
|
||||||
|
test()
|
||||||
|
sys.exit(0)
|
||||||
s=ser()
|
s=ser()
|
||||||
s.open("com8")
|
s.open("com8")
|
||||||
password=data_get().get("index",0)
|
password=data_get().get("index",0)
|
||||||
|
Reference in New Issue
Block a user