Форум сайта python.su
from com.android.monkeyrunner import MonkeyRunner device = MonkeyRunner.waitForConnection() while True: img = device.takeSnapshot() a = [] for i in range(1535): a.append(img.getRawPixel(1150, i)) if img.getRawPixel(1200, i) == (-1, 225, 13, 13): v = i r, b = a.index((-1, 247, 27, 27))+12, a[1190:].index((-1, 0, 0, 0)) + 1190 b -= r k = 25 if b >= 450 else 15 if b < 150: k = 215 if v: v = (b+r-v)/870.0 device.drag((0, 0), (0, 0), b/(1500.0-k), 1) MonkeyRunner.sleep(0.9) device.touch(0, 0, 'DOWN_AND_UP') MonkeyRunner.sleep(v) device.touch(0, 0, 'DOWN_AND_UP') MonkeyRunner.sleep(3-v) else: device.drag((0, 0), (0, 0), b/(1500.0-k), 1) MonkeyRunner.sleep(3)
Офлайн