frompynput.mouseimportListenerdefon_click(x,y,button,pressed):ifpressed:print(f"鼠标点击位置: ({x},{y})")defdetect_loading_status(app):defon_move(x,y):# 假设鼠标在特定区域内移动时表示加载状态if100<=x<=200and100<=y<=200:app.update_status("加载中")else:app.update_status("未加载")wi...
self.iterate_blocks_number(BoomMine.detect_mine) # Calculate where to click self.iterate_blocks_number(BoomMine.detect_to_click_block) if self.is_in_form(mouseOperation.get_mouse_point()): for to_click in self.next_steps: on_screen_location = self.rel_loc_to_real(to_click) mouseOperatio...
[sg.Text('开始:',size=(6, 1)), sg.Text('', key='st_xy',size=(10, 1)), sg.Text('', key='st_RGB', size=(12, 1)), sg.Button('两秒后检测', key='st_detect',size=(9,1))], [sg.Text('结束:', size=(6, 1)), sg.Text('', key='end_xy', size=(10, 1)), ...
# Analyze the number of blocksself.iterate_blocks_image(BoomMine.analyze_block)# Mark all minesself.iterate_blocks_number(BoomMine.detect_mine)# Calculate where to clickself.iterate_blocks_number(BoomMine.detect_to_click_block)ifself.is_in_form(mouseOperation.get_mouse_point()):forto_click in...
self.iterate_blocks_number(BoomMine.detect_to_click_block) if self.is_in_form(mouseOperation.get_mouse_point()): for to_click in self.next_steps: on_screen_location = self.rel_loc_to_real(to_click) mouseOperation.mouse_move(on_screen_location[0], on_screen_location[1]) ...
2defmouse_click(event, x, y, flags, para): 3ifevent == cv2.EVENT_LBUTTONDOWN:# 左边鼠标点击 4print( x, y) 5m.position = (x, y) 6time.sleep(0.1) 7m.click(Button.left,1) (3)GUI界面初始化,由于我们需要把实时的视频显示在窗口上,故也需要使用到opencv。
# Calculate where to clickself.iterate_blocks_number(BoomMine.detect_to_click_block) if self.is_in_form(mouseOperation.get_mouse_point):for to_click in self.next_steps:on_screen_location = self.rel_loc_to_real(to_click)mouseOperation.mouse_move(on_screen_location[0], on_screen_location[...
1print("等待连接---")2defmouse_click(event,x,y,flags,para):3ifevent==cv2.EVENT_LBUTTONDOWN:# 左边鼠标点击4f=open("1.txt","w")5f.write(str(x)+","+str(y))6f.close() (3)创建服务器端接收数据函数,用来实时接收传输过来的图像数据并显示: ...
2def mouse_click(event, x, y, flags, para): 3 if event == cv2.EVENT_LBUTTONDOWN: # 左边鼠标点击 4 f=open("1.txt","w") 5 f.write(str(x)+","+str(y)) 6 f.close() (3)创建服务器端接收数据函数,用来实时接收传输过来的图像数据并显示: ...
# Calculate where to clickself.iterate_blocks_number(BoomMine.detect_to_click_block) if self.is_in_form(mouseOperation.get_mouse_point()):for to_click in self.next_steps:on_screen_location = self.rel_loc_to_real(to_click)mouseOperation.mouse_move(on_screen_location[0], on_screen_locatio...