Home >Backend Development >Python Tutorial >How to use qpython3l
QPython3 is a Python3 script engine that runs on Android. It integrates the Python3 interpreter, Console, editor and SL4A library. It allows you to run programs developed in Python language on Android devices. It's Python on Android! In addition, it provides development tools that allow you to easily develop Python projects on Android devices.
Developer Tools Panel
If you swipe left on the launch button's panel, you will see another main panel. It will be more practical and convenient for developers.
Console
As I said before, QPython has the same Python console as the PC version, and many users are accustomed to using it to explore programming objects properties, experiment with syntax or test ideas they already have. You can type commands directly into the terminal and let the Python parser execute them. Click the " " icon in the upper right corner of the console to create a new terminal window. Click the arrow in the upper left corner to display a list of currently open console windows, so that you can switch to a different console. If you want to close the console, click the close button "x".
Please note that after opening the console, a small terminal icon will appear in the message prompt column unless you have closed the terminal. If you open the prompt window and click the small terminal icon, you can return to the terminal again.
Editor
The editor allows you to enter and edit text. You can develop your scripts, save and run them. The editor supports Python syntax highlighting and display of line numbers.
While typing, you can easily control the tightening level (important for Python) via the first two icons "<" and ">" in the bottom control bar. Next is "Jump to? Row", click the icon, enter the number of rows to quickly jump to the number of rows you want to jump to, then save and save as, then run, undo, search, recently opened , code snippets and editor settings buttons. Don’t forget there are Open and New buttons on the right side of the top navigation.
When saving, don’t forget to add the “.py” suffix to the suffix name, because the editor will not complete it automatically.
Program
In the program you can manage your scripts and projects, which are located in /sdcard/com.hipipal.qpyplus/scripts and /sdcard/com respectively. hipipal.qpyplus/projects.
After entering the program, when long-pressing a script or project, you can create a shortcut corresponding to the script or project on the desktop. After you create their shortcuts, you can launch them directly from the desktop. .
Use qpython3 to write the simplest program for sending text messages
So far, there are not many mobile applications developed in python, but qpython can be recommended as a good toy. Come and play.
Write the simplest program to send text messages. The code is as follows:
#-*-coding:utf8;-*-#qpy:3#qpy:consolefrom sl4a import * s = Android().smsSend s("185778xxxxx","Python大*法好")
Just three lines, -_-That code was really written by me on my mobile phone while lying in bed.
Code examples of python texting from the Internet:
import sl4a droid = sl4a.Android() droid.smsSend("0044....","sms")
Pitfalls:
The protection software on the mobile phone may prohibit various permissions of qpython by default. For example, permission to send text messages. Just set it to trust.
qpython3 can create a shortcut of the written python program to the mobile phone desktop, and double-click to run the python program
The above is the detailed content of How to use qpython3l. For more information, please follow other related articles on the PHP Chinese website!