首页上一页 1 下一页尾页 7 条记录 1/1页
程序如下:
PIL, numpy matplotlib.pyplot plt matplotlib.widgets Button warnings os time threading numpy ndarray warnings.filterwarnings() get_screen_image(): os.system() os.system() numpy.array(PIL.Image.open()) coor = [] ax = isAuto = on_click(event): isAuto == : event.xdata != event.ydata != : : x = (event.xdata) y = (event.ydata) x > y > : coor.append((x, y)) (coor) == : () (coor) : () (coor) ax ax = figure.add_subplot(, , ) ax.plot(x, y, ) figure.canvas.draw() (coor) == : jump_to_next(coor.pop(), coor.pop()) ax.lines.clear() th = threading.Thread(=update) th.start() : () jump_to_next(point1, point2): x1, y1 = point1; x2, y2 = point2; distance = ((x2 - x1) ** + (y2 - y1)) ** os.system(.format((distance * ))) () update(): time.sleep() () axes_image.set_array(get_screen_image()) figure.canvas.draw() __name__ == : figure = plt.figure() axes_image = plt.imshow(get_screen_image(), =) figure.canvas.mpl_connect(, on_click) reelect_button_position = plt.axes([, , , ]) m = numpy.array(PIL.Image.open()) reelect_button = Button(reelect_button_position, =, =m) m1 = numpy.array(PIL.Image.open()) auto_button_position = plt.axes([, , , ]) auto_button = Button(auto_button_position, =, =m1) plt.show()
运行结果:
(按了一下)
于2021-10-03 21:26:58编辑