python版微信跳一跳游戏辅助
作者:Primary_wind 时间:2021-08-16 09:03:19
本文实例为大家分享了微信跳一跳游戏辅助python代码,供大家参考,具体内容如下
import os
import PIL
import numpy
import matplotlib
matplotlib.use('TKAgg')
import matplotlib.pyplot as plt
import time
from matplotlib.animation import FuncAnimation
# 是否需要进行图片更新
need_update = True
def get_screen_image():
# 截取手机当前图片
os.system('adb shell screencap -p /sdcard/screen.png')
# 拉取到PC端
os.system('adb pull /sdcard/screen.png')
# 将图像转成数组返回
return numpy.array(PIL.Image.open('screen.png'))
def jump_to_next(point1, point2):
x1, y1 = point1;
x2, y2 = point2
distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
# 计算按压指令和按压时长
os.system("adb shell input touchscreen swipe 320 410 320 410 %d" % (distance * 1.35))
def on_clack(event, coor=[]):
global need_update
coor.append((event.xdata, event.ydata))
if len(coor) == 2:
# 执行跳步指令
jump_to_next(coor.pop(), coor.pop())
# 进行图片刷新
need_update = True
def update_screen(frame):
global need_update
if need_update:
time.sleep(2)
axes_image.set_array(get_screen_image())
# 已刷新,设置为false
need_update = False
return axes_image,
figure = plt.figure()
axes_image = plt.imshow(get_screen_image(), animated=True)
figure.canvas.mpl_connect('button_press_event', on_clack)
# 定时更新
ani = FuncAnimation(figure, update_screen, interval=50, blit=True)
plt.show()
更多内容大家可以参考专题《微信跳一跳》进行学习。
来源:http://blog.csdn.net/primary_wind/article/details/78997536
标签:python,微信,跳一跳
0
投稿
猜你喜欢
Linux中Oracle启动侦听报错TNS:permission denied的解决方法
2024-01-14 02:44:17
解决selenium模块利用performance获取network日志请求报错的问题(亲测有效)
2022-12-22 11:09:26
儿童学习python的一些小技巧
2021-10-14 05:09:40
python实现简单的超市商品销售管理系统
2021-08-24 00:07:32
python实战教程之OCR文字识别方法汇总
2021-09-20 05:36:21
使用Python解析Chrome浏览器书签的示例
2023-03-12 01:14:34
js解析xml字符串和xml文档实现原理及代码(针对ie与火狐)
2024-04-18 09:51:29
python实现取余操作的简单实例
2021-08-21 01:00:51
python 自动去除空行的实例
2021-04-12 08:46:04
Window 7/XP 安装Apache 2.4与PHP 5.4 的过程详解
2023-11-24 09:28:09
Yahoo!网站性能最佳体验的34条黄金守则——图片、Coockie与移动应用
2008-05-29 13:44:00
使用Visual Studio 2022开发前端的详细教程
2023-07-02 05:30:35
NumPy 如何生成多维数组的方法
2022-06-26 20:40:51
Python实现Tracert追踪TTL值的方法详解
2023-06-24 13:08:14
基于python实现MUI区域滚动
2023-11-04 02:38:52
简单的Python人脸识别系统
2023-01-26 23:31:57
python中单下划线(_)和双下划线(__)的特殊用法
2022-08-09 22:23:22
SQL语句实现删除ACCESS重复记录的两种方法
2024-01-24 21:43:25
快速了解python leveldb
2023-06-03 11:12:19
javascript实现右下角广告框效果
2024-04-17 10:25:08