加入收藏 | 设为首页 | 交流中心 | 我要投稿 | RSS
您当前的位置:首页 > 技术中心 > 高谈阔论

QPython - How To Start

时间:2017-04-21 09:30:57  来源:  作者:

 7Iz快充网络

A. Dashboard

 7Iz快充网络

qpython-00.png
Pic. 1

 7Iz快充网络

After you installed QPython, start it in the usual way by tapping its icon in the menu. Screenshot on the top of this post shows what you should see when QPython just started.7Iz快充网络

Start button

By tapping the big button with Python logo in the center of the screen you can7Iz快充网络

  • Launch your local script or project
  • Get script from QR code (funny brand new way to share and distribute your code, you can create QRCode through QPython's QRCode generator

Now you can install many 3rd libaries ( pure python libraries mainly ) through pip_console.py script after the version 0.9.8 .7Iz快充网络

If you want QPython to run some script of project when you click the start button, you can make it by setting default program in setting activity.7Iz快充网络

Developer kit dashboard

If you swipe to the left instead of tapping, you will see another (second) main screen of QPython (Pic. 2). As for me, it is much more useful and comfortable for developer.7Iz快充网络

 7Iz快充网络

qpython-02.png
Pic. 2

 7Iz快充网络

Tools available here:7Iz快充网络

  • Console — yes, it's regular Python console, feel free to comunicate with interpreter directly
  • Editor — QPython has a nice text editor integrated with the rest, you can write code and run it without leaving the application
  • My QPython — here you can find your scripts and projects
  • System — maintain libraries and components: install and uninstall them
  • Package Index opens the page QPyPI in browser allowing to install packages listed there
  • Community leads to QPython Questions page. Signup and feel free to ask and answer questions in the community.

By long clicking on the console or editor, you have chance to create the shortcut on desktop which allow you enter console or editor directly.7Iz快充网络

Next, let's see the console and the editor. (Pic. 3)7Iz快充网络

B. Console and editor

 7Iz快充网络

qpython-03.png
Pic. 3

 7Iz快充网络

As I said before, there is an ordinary Python console. Many people usually use it to explore objects' properties, consult about syntax and test their ideas. You can type your commands directly and Python interpreter will execute them. You can open additional consoles by tapping the plus button (1) and use drop-down list on the upper left corner to switch between consoles (2). To close the console just tap the close button (3).7Iz快充网络

 7Iz快充网络

qpython-04.png
Pic. 4

 7Iz快充网络

Please note, there will be notification in the notification bar unless you explicitly close the console and you always can reach the open console by tapping the notification. (Pic. 4)7Iz快充网络

 7Iz快充网络

qpython-05.png
Pic. 5

 7Iz快充网络

The editor allows you obviously (hello Cap!) enter and modify text. Here you can develop your scripts, save them and execute. The editor supports Python syntax highlighting and shows line numbers (there is no ability to go to the line by number though). (Pic. 5)7Iz快充网络

When typing, you can easily control indentation level (which is critical for Python code) using two buttons on the toolbar (1). Next buttons on the toolbar are Save and Save As (2), then goes Run(3), UndoSearchRecent Files and Settings buttons. Also there are two buttons on the top: Open and New (5).7Iz快充网络

When saving, don't forget to add .py estension to the file name since the editor don't do it for you.7Iz快充网络

C. My QPython

You can find the scripts or projects in My QPython. My QPython contains the scripts and Projects.7Iz快充网络

By long clicking on script or project, you have chance to create the shortcut for the script or project. Once you have created the shortcuts on desktop, you can directly run the script or project from desktop.7Iz快充网络

Scripts

Scripts : A single script. The scripts are in the /sdcard/com.hipipal.qpyplus/scripts directory. If you want your script could be found in My QPython, please upload it to this directory.7Iz快充网络

When you click the script, you can choose the following actions:7Iz快充网络

  • Run : Run the script
  • Open : Edit the script with built-in editor
  • Rename : Rename the script
  • Delete : Delete the script

Projects

Projects : A directory which should contain the main.py as the project's default launch script, and you can put other dependency 3rd libraries or resources in the same directory, if you want your project could be found in My QPython, please upload them into this directory.7Iz快充网络

When you click on the project, you can choose the following actions:7Iz快充网络

  • Run : run the project
  • Open : use it to explore project's resources
  • Rename : Rename the project
  • Delete : Delete the project

D. System

You can manage the installed libraries and the components here. System module contains the site-packages libraries you have installed.7Iz快充网络

In addition, you can install some libraries which seem to belong to the global category, like _ssl,_csv etc libraries.7Iz快充网络

Libraries

Libraries part includes the global libraries and the installed libraries mentioned above. You have the chance to visit it's detail after click on the item. Or you can remove it by choose the uninstall menu.7Iz快充网络

Usually, the libraries could be install into the following paths:7Iz快充网络

/sdcard/com.hipipal.qpyplus/lib/python2.7/site-packages ( Pure python libraries usually will be installed into here ) And7Iz快充网络

/data/com.hipipal.qpyplus/files/lib/python2.7/site-packages/ ( Libraries with *.so that implemented by c or c plus plus usually will be installed into here )7Iz快充网络

How to install 3rd libraries

If you want to install some simple 3rd pure libraries, you can put them into the first path easily.7Iz快充网络

If you want to install the python libraries mixed with c/c++ files, you need to cross-compile them first, after that, you can use the following methods to install them:7Iz快充网络

  • Simply copy them into the /sdcard/com.hipipal.qpyplus/lib/python2.7/site-packages7Iz快充网络

  • If the libraries do not work well when they are in the sdcard, you may think about to move it into device's storage, so you can make a qpython component and put it into /sdcard/com.hipipal.qpyplus/lib , after that, you can extract it in components manage.7Iz快充网络

  • ...7Iz快充网络

Components

Components part includes QPython's components. A component many contain many parts which may be installed into different locations in your device. For example, there is a PIP component. It contains the following files: pip command which should be install into the /data/data/com.hipipal.qpyplus/files/bin directorypip related libraries, which should be install into /data/data/com.hipipal.qpyplus/lib/python2.7/site-packages/7Iz快充网络

You can install the component through the following steps7Iz快充网络

  • Download the component
  • Extract the component into your device

E. Packages Index

You can get many packages through Packages Index, and it will contain detail programming introduction. There are three categories in QPython. You can extend your qpython's programming ability through installing packages.7Iz快充网络

ANDROID Programming with SL4A

This category contain many interesting packages which let you drive your android work.7Iz快充网络

WEB Programming with Django

You can implement WEB Apps quickly through web programming in QPython7Iz快充网络

GUI Programming with Kivy

If you want to develop game with script, you should get packages from GUI programming with kivy7Iz快充网络

F. Community

You can get real people support in community, many questions of qpython usage or programming could be asked in community. We will answer you as soon.7Iz快充网络

来顶一下
返回首页
返回首页
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
推荐资讯
相关文章
    无相关信息
栏目更新
栏目热门