Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Prerequisites
- • Android device with USB debugging enabled (Settings → Developer options → USB debugging)
- • USB cable and free USB port on your PC
- • Android SDK Platform-Tools unzipped (e.g. C:\adb\platform-tools)
- • Python 3 installed globally
- Start ADB & confirm device
- • Open PowerShell or CMD
- • Change into your Platform-Tools folder:
- cd C:\adb\platform-tools
- • Run:
- adb.exe start-server
- adb.exe devices
- • Verify your device serial appears under “List of devices attached.”
- Install Python packages
- • In any console window, run:
- pip install --upgrade pip
- pip install pure-python-adb numpy pillow
- Prepare script & image
- • Place your draw.py script in a folder, e.g. (downloaded from https://gist.github.com/paciops/40c22ebd2d14aa330220a6d12731fcfa)
- C:\path\to\draw.py
- • Put your image file in a known location, e.g.
- C:\path\to\your\image.jpg
- Run the drawing script
- • In PowerShell/CMD, execute:
- python C:\path\to\draw.py C:\path\to\your\image.jpg
- • Watch for console logs (“Connected to…”, “Total swipes…”) and the image being drawn on your device.
- Troubleshooting
- • No device listed: check cable, USB port and re-authorize USB debugging on the phone
- • Permission denied on device.shell(...): revoke and re-allow USB debugging
- • Swipes off-screen or invisible: print out mapped coordinates in your script and adjust screen_start_x, screen_start_y or scale
- • ADB server errors:
- adb.exe kill-server
- adb.exe start-server
Advertisement
Add Comment
Please, Sign In to add comment