微信跳一跳輔助工具(Python)

2021-08-15 03:54:56 字數 1577 閱讀 3140

安卓手機 –>蘋果手機僅僅只是驅動不同,故而程式**會略有不同

usb線接好手機和電腦 –>保證電腦的埠驅動沒有問題,手機usb除錯模式開啟

#!/usr/bin/env python

#coding=utf-8

import os

import pil,numpy

import matplotlib.pyplot as plt

from matplotlib.animation import funcanimation

import time

need_update = true

defget_screen_images

(): os.system('adb shell screencap -p /sdcard/screen.png') #獲取當前介面的手機截圖

os.system('adb pull /sdcard/screen.png') #下在當前這個截圖到電腦的當前資料夾下面

return numpy.array(pil.image.open('screen.png'))

defjump_to_next

(point1, point2):

x1, y1 = point1; x2, y2 = point2

distance = ((x2-x1)**2 + (y2-y1)**2)**0.5

os.system('adb shell input swipe 320 410 320 410 {}'.format(int(distance*2.00)))

defon_click

(event, coor=):

#[(x1,y1),(x2,y2)]

if len(coor) == 2:

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

need_update = true

defupdate_screen

(frame):

#更新**

global need_update

if need_update:

time.sleep(1)

axes_image.set_array()

need_update = false

return axes_image,

figure = plt.figure() #建立乙個空白的物件

axes_image = plt.imshow(get_screen_images(),animated=true) #把獲取的**畫在座標軸上

figure.canvas.mpl_connect('button_press_event', on_click)

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

plt.show()

注意:

- func():返回的結果是值

- func:返回的是物件

模組在import後,如果顯示錯誤,請按照你習慣的方式進行必要的安裝

微信跳一跳輔助

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

微信跳一跳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出...