用python來玩微信跳一跳

2022-08-30 00:45:12 字數 2442 閱讀 1760

一:準備工具

安卓手機

開啟手機除錯模式

usb線接好手機和電腦

pycharm:專門用於python開發的ide工具

實現原理

gui 布局

建立視窗 -> 新增控制項 -> 顯示視窗

二、關於python、模組的安裝,和**。

1.在電腦上安裝python(我用的是win10和phthon3.6版本)

安裝步驟和借鑑:

numpy-1.14.0rc1-cp36-none-win_amd64.whl

pillow-5.0.0-cp36-cp36m-win_amd64.whl

matplotlib-2.1.1-cp36-cp36m-win_amd64.whl

pip3.6 install c:\python36\scripts\numpy-1.14.0rc1-cp36-none-win_amd64.whl

pip3.6 install c:\python36\scripts\pillow-5.0.0-cp36-cp36m-win_amd64.whl

pip3.6 install c:\python36\scripts\matplotlib-2.1.1-cp36-cp36m-win_amd64.whl

3.下面是用到的**,可以複製下來,儲存為main.py。

#

!/usr/bin/env python

#-*- coding:utf-8 -*-

__author__ = 'wechat

'import

osimport

pil,numpy

import

matplotlib.pyplot as plt

from matplotlib.animation import

funcanimation

import

time

need_update =true

defget_screen_image():

os.system(

'adb shell screencap -p /sdcard/screen.png

')#獲取當前介面的手機截圖

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.5os.system(

'adb shell input swipe 320 410 320 410 {}

'.format(int(distance*1.35)))

def on_calck(event, coor=):#

繫結的滑鼠單擊事件

global

need_update

if len(coor) == 2:

jump_to_next(coor.pop(), coor.pop())

need_update =true

def update_screen(frame):#

更新 /從畫

global

need_update

ifneed_update:

time.sleep(1)

axes_image.set_array(get_screen_image())

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_calck)

ani = funcanimation(figure, update_screen, interval=50, blit=true)

plt.show()

然後在jump_demo這個資料夾中直接開啟powershell(在檔案中shift+滑鼠右鍵,選擇在此處開啟power shell視窗)了,

或者在cmd裡面,找到相對應的資料夾,然後,執行c:\users\dell\desktop\jump_demo> python main.py

最後建議大家不要把分數刷的太高,容易被拉黑。\捂臉笑。

微信跳一跳python 微信跳一跳Python

1 安裝python,我用的是python2.7 5.安裝pillow,放在scripts資料夾中,通過 pip install pillow安裝 6.安裝adb工具包,可以直接放在專案 的資料夾裡面,或者放在c盤目錄不過要配置一下環境變數,我這裡是直接放在專案 資料夾中。內建了cmd 命令 7.把...

python 微信跳一跳

因為是基於python的指令碼所以要先安裝python 這裡有教程 點選這裡 安裝好之後開始下面的操作 這裡是對adb的解釋 2.安裝好之後將安裝路徑配置到環境變數中 注意 路徑後加 英文格式的 號,例如d adb 3.快捷鍵win r開啟cmd win鍵即ctrl和alt中間那個鍵 輸入 adb出...

微信跳一跳輔助

background pos distance to time ratio 1.35 screenshot path tempfile.gettempdir screenshot.png def calculate jump distance im image.open screenshot pat...