01 Introduction

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

02 The Home Screen

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.

1. First Home Screen

Main Screen

  1. 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.
  2. Setting Screen: tap here is going to setting screen.

  3. Quick start: tap 'Quick start' will redirect to wiki site.

  4. Swipe right to main functions screen.

2. Second Home Screen

Main Functions Screen

  1. 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.

  2. 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.

  3. 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.

  4. All installed libraries will show in System screen. It's easy to uninstall and check path.

  5. 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.

  6. This is our Community. If you want get some help, please post your question in our Community.

  7. Tap here will redirect to QPython's Facebook page.

03 Run a local script or project

Once you tap the main button, it will show you 3 items as follows.

Main Button Popup

1. Run local script

In this menu, you can run a script which is under My QPython scripts menu.

Run Scripts

2. Run local project

To run a QPython project. All of these projects should be installed on My QPython Projects menu.

Run Projects

04 Get a script from QRCode

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.

Scan a QRCode Image

05 Try console

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!"

Console

  1. Tap this button to close current Console window
  2. Tap this button to add a new Console
  3. This name is the current Console name, tap it will show you a menu to switch Console window
  4. Type in Python codes here

06 Write a helloworld.py with QEdit

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.

07 Install a system library

Modules can be added to QPython by putting the module in the site-packeges directory

08 Install a 3rd party library

09 Upload a script/project to QPython

10 Create a shortcut

11 Setting activity

12 About activity