QPython is Python on Android! It is a Python Engine, you can running it on your Android devices like cell phone or tablet. It included the Python interpreter, console, editor, libs and so on.
This article tell what functions QPython contain and how to use them.
Main Features - Supports WEB programming, which can let you develop Web apps - Supports native UI programming, which can let you make games - Supports SL4A programming to access Android’s features: network, Bluetooth, GPS, and more - Run Python scripts/projects on Android devices - Read Python codes from QRCode - Allow programers create/edit Python scripts easily through built-in QEditor - Supports FTP server, it's easy to upload/download your Python codes between PC and android devices
There are two main screens. You can run a script or project on the first main screen, more functions you can swipe right to the second main screen.
Main Button: This is a main button of QPython, to tap this button will popup a menu. There are 3 items in this menu.
- Get a script from QRCode , it will enable your camera to scan a QRCode.
- Run local script, try to run a script in scripts directory.
- Run local project, try to run a project in projects directory.
Setting Screen: tap here is going to setting screen.
Quick start: tap 'Quick start' will redirect to wiki site.
Swipe right to main functions screen.
The Console function, QPython will into console mode if you tap this button. If you press the console icon in 2 seconds, it will confirm with you to create a short-cut on desktop.
This is a built-in editor. You can write a new script file or edit existing files. If you press the editor icon in 2 seconds, it will confirm with you to create a short-cut on desktop.
My QPython will let you know the status of local scripts&projects. When you are browsing the scripts&projects, If you press the script or project icon in 2 seconds, it will confirm with you to create a short-cut on desktop.
All installed libraries will show in System screen. It's easy to uninstall and check path.
Package Index is kind of like PYPI of Python. If you install a library, it will show in System screen. For scripts or projects, it will show in My QPython screen.
Tap here will redirect to QPython's Facebook page.
Once you tap the main button, it will show you 3 items as follows.
In this menu, you can run a script which is under My QPython scripts menu.
To run a QPython project. All of these projects should be installed on My QPython Projects menu.
First, you have to find a QRCode image which was generated by Python codes. If you don't, please click this link(http://www.qpython.com/create.php) to create new one.
Once you got a QRCode image, QPython will be able to get Python codes from it. In the main button popup menu, tap "Get script from QRCode" to scan a QRCode image.
Tap the Console button in second home screen to move on Console screen. Type in some codes for testing.
import os, sys from time import localtime print "Hello world!"
Tap the Editor button in second home screen to enter QEdit. Type in codes of Helloworld.py.
import androidhelper droid = androidhelper.Android() s = 'Hello World!' droid.makeToast(s)
Tap save button to save this file as testhelloworld.py.
Modules can be added to QPython by putting the module in the site-packeges directory