Kivy简介

Kivy 是一套 Python 下的跨平台快速应用开发框架,对于多点触控有着良好的支持。不用深入学习 Java 或 Object C 即可开发流行智能手机平台应用。

Kivy 依据允许商业使用 LGPLv3 协议发布,支持 Linux, Windows, MacOSX, Android 和 iOS 平台,原生支持各个平台的输入设备协议,包括多点触控;其图形核心围绕 OpenGL ES2 构建,可以充分利用目标平台的 GPU 加速。

当前最新版本是1.72.

官方网站:http://kivy.org/#home


安装测试

环境:Ubuntu 12.04 64bit 

1.下载源码包



下载好之后解压到 将压缩包解压到 /usr/local/lib 下面。


2.安装依赖

终端运行

sudo apt-get install python-setuptools python-pygame python-opengl \
python-gst0.10 python-enchant gstreamer0.10-plugins-good python-dev \
build-essential libgl1-mesa-dev libgles2-mesa-dev cython


3.安装&跑Demo

把解压后的文件夹名字改一下,直接

终端执行

cd /usr/local/lib/

sudo easy_install Kivy



在Kivy的examples中有很多的例子,例如:

3Drendering

python /3Drendering/main.py



Shader



最后来个HelloWorld: copy

  1. import kivy  

  2. kivy.require('1.4.1')  

  3.   

  4. from kivy.app import App   

  5. from kivy.uix.button import Button   

  6.   

  7. class HeiBoyApp(App):  

  8.     """docstring for MyApp"""  

  9.     def build(self):  

  10.         return Button(text='Hello World')  

  11.   

  12. if __name__ == '__main__':  

  13.     HeiBoyApp().run()  


运行:python test.py 


结果就是一个窗口里面有一个超级大的Button。





Android下跑kivy

可以看看Google play上kivy的demo:

Kivy Lanucher:https://play.google.com/store/apps/details?id=org.kivy.pygame

Kivy demos for Android下载后放到/sdcard/kivy文件夹中就可以运行了,效果还算不错。

下面来手动编译一下 python on Android 。

这里环境采用的是官网提供的virtual box的ubuntu的镜像,因为这个东西的编译环境配置起来实在是太太麻烦了。

在ubuntu中创建一个ubuntu的虚拟机然后将镜像加载进去就可以了。

下面开始编译。


0.更新cython

编译的时候需要将cython升级到最新版。

sudo pip install --upgrade cython


1.下载源码

git clone git://github.com/kivy/python-on-android


2.设置包package

终端cd到python-on-android中运行

./distribute.sh -m "kivy"

运行成功的话在dist文件夹下面会出现一个default文件夹,里面就是一个工程模板。


3.编译

编译单个应用:

终端cd到default文件夹中,执行:

./build.py --dir ~/code/kivy/examples/demo/touchtracer \
--package org.demo.touchtracer \
--name "Kivy Touchtracer" --version 1.1.0 debug 

编译一个launcher

lancher 会自动搜索sdcard/kivy目录下的工程,并给出工程列表,可以选择执行。

./build.py --launcher
--package org.demo.touchtracer \
--name "Kivy launcher" --version 1.1.0 debug 


编译好之后在bin文件夹下就会出现一个apk,放到手机中就可以安装了。



TIOBE Index for February 2018

February Headline: The last gasp attempt of Visual Basic to score?

If you look closely at this month's publication, Visual Basic.NET and classic Visual Basic are doing great. This is really surprising. About 2 years ago we stated in an interview about the TIOBE index that it was a matter of some years before Visual Basic would have disappeared. Visual Basic is considered the programming language for newbies in the field of programming and rapid prototyping. That's why it has a bad image among expert programmers. Despite all this, Visual Basic seems to survive. Last week Mads Torgersen of Microsoft announced that they will stop with the co-evolution strategy of C# and Visual Basic. This means that Visual Basic will fall behind if compared to new C# features. Let's see whether Visual Basic can take this new punch and keep on surviving.

IMPORTANT NOTE. SQL has been added again to the TIOBE index since February 2018. The reason for this is that SQL appears to be Turing complete. As a consequence, there is no recent history for the language and thus it might seem the SQL language is rising very fast. This is not the case.

The TIOBE Programming Community index is an indicator of the popularity of programming languages. The index is updated once a month. The ratings are based on the number of skilled engineers world-wide, courses and third party vendors. Popular search engines such as Google, Bing, Yahoo!, Wikipedia, Amazon, YouTube and Baidu are used to calculate the ratings. It is important to note that the TIOBE index is not about the best programming language or the language in which most lines of code have been written.

The index can be used to check whether your programming skills are still up to date or to make a strategic decision about what programming language should be adopted when starting to build a new software system. The definition of the TIOBE index can be found here.

Feb 2018Feb 2017ChangeProgramming LanguageRatingsChange
11
Java14.988%-1.69%
22
C11.857%+3.41%
33
C++5.726%+0.30%
45changePython5.168%+1.12%
54changeC#4.453%-0.45%
68changeVisual Basic .NET4.072%+1.25%
76changePHP3.420%+0.35%
87changeJavaScript3.165%+0.29%
99
Delphi/Object Pascal2.589%+0.11%
1011changeRuby2.534%+0.38%
11-changeSQL2.356%+2.36%
1216changeVisual Basic2.177%+0.30%
1315changeR2.086%+0.16%
1418changePL/SQL1.877%+0.33%
1513changeAssembly language1.833%-0.27%
1612changeSwift1.794%-0.33%
1710changePerl1.759%-0.41%
1814changeGo1.417%-0.69%
1917changeMATLAB1.228%-0.49%
2019changeObjective-C1.130%-0.41%


Ratings (%)JavaCC++PythonC#Visual Basic .NETPHPJavaScriptDelphi/Object PascalRuby200220042006200820102012201420162018051015202530Sunday, Apr 7, 2013 C++: 9.714%TIOBE Programming Community IndexSource: www.tiobe.com


Other programming languages

The complete top 50 of programming languages is listed below. This overview is published unofficially, because it could be the case that we missed a language. If you have the impression there is a programming language lacking, please notify us at tpci@tiobe.com. Please also check the overview of all programming languages that we monitor.

PositionProgramming LanguageRatings
21SAS1.112%
22Dart1.018%
23Scratch0.939%
24Logo0.786%
25Erlang0.739%
26LabVIEW0.715%
27Transact-SQL0.651%
28COBOL0.631%
29D0.532%
30ABAP0.532%
31Lua0.522%
32Scala0.506%
33Fortran0.483%
34Ada0.462%
35Scheme0.460%
36Lisp0.420%
37Prolog0.332%
38Apex0.316%
39Ladder Logic0.299%
40Bash0.295%
41OpenEdge ABL0.249%
42Clojure0.231%
43Haskell0.228%
44Kotlin0.202%
45Ring0.197%
46Rust0.196%
47F#0.194%
48Hack0.190%
49Groovy0.189%
50Julia0.189%

The Next 50 Programming Languages

The following list of languages denotes #51 to #100. Since the differences are relatively small, the programming languages are only listed (in alphabetical order).

  • (Visual) FoxPro, 4th Dimension/4D, ActionScript, Alice, Applescript, Arc, ATLAS, Awk, BBC BASIC, bc, Bourne shell, C shell, CL (OS/400), Common Lisp, Crystal, Elixir, Elm, Forth, Icon, Io, J, J#, Korn shell, LiveCode, Maple, ML, MOO, MQL4, NATURAL, NXT-G, OCaml, OpenCL, Oz, PL/I, PostScript, PowerShell, Programming Without Coding Technology, Pure Data, Q, Racket, REXX, RPG (OS/400), S, Simulink, SPARK, Stata, Tcl, VBScript, Verilog, VHDL



This Month's Changes in the Index

This month the following changes have been made to the definition of the index:

  • After some discussion with Eberhard Tscheuschner we had to admit that SQL is Turing complete because of its Common Table Expressions feature. In 2004 we decided the opposite, but now SQL is back and started at position 11.

  • Joek van Montfort suggested to add Snap! as a programming language to the TIOBE index. Snap! meets all requirements and has been added. It is currently at position 166.

  • Some people observed the unexpected rise of the programming language Crystal. Dominik Picheta sorted out why this happened: programming crystals is a popular occult hobby nowadays. We rechecked all Crystal programming pages and 39% of them turned out to be not related to the programming language. This has been adjusted in the definition. As a consequence Crystal dropped from position 62 to 91.

  • There are lots of mails that still need to be processed. As soon as there is more time available your mail will be answered. Please be patient.



Very Long Term History

To see the bigger picture, please find below the positions of the top 10 programming languages of many years back. Please note that these are averagepositions for a period of 12 months.

Programming Language2018201320082003199819931988
Java121118--
C2122111
C++3433225
Python476122616-
C#5579---
Visual Basic .NET613-----
JavaScript798721--
PHP8645---
Perl9854311-
Ruby1010919---
Objective-C1834547---
Ada28151714772
Lisp31121413643
Pascal13614199711313

Programming Language Hall of Fame

The hall of fame listing all "Programming Language of the Year" award winners is shown below. The award is given to the programming language that has the highest rise in ratings in a year. 

YearWinner
2017medal C
2016medal Go
2015medal Java
2014medal JavaScript
2013medal Transact-SQL
2012medal Objective-C
2011medal Objective-C
2010medal Python
2009medal Go
2008medal C
2007medal Python
2006medal Ruby
2005medal Java
2004medal PHP
2003medal C++



Bugs & Change Requests

This is the top 5 of most requested changes and bugs. If you have any suggestions how to improve the index don't hesitate to send an e-mail to tpci@tiobe.com.

  1. Apart from " programming", also other queries such as "programming with ", " development" and " coding" should be tried out.

  2. Add queries for other natural languages (apart from English). The idea is to start with the Chinese search engine Baidu. This has been implemented partially and will be completed the next few months.

  3. Add a list of all search term requests that have been rejected. This is to minimize the number of recurring mails about Rails, JQuery, JSP, etc.

  4. Start a TIOBE index for databases, software configuration management systems and application frameworks.

  5. Some search engines allow to query pages that have been added last year. The TIOBE index should only track those recently added pages.



Frequently Asked Questions (FAQ)

  • Q: Am I allowed to show the TIOBE index in my weblog/presentation/publication?

    A: Yes, the only condition is to refer to its original source "www.tiobe.com".

  • Q: How may I nominate a new language to be added to the TIOBE index?

    A: If a language meets the criteria of being listed (i.e. it is Turing complete and has an own Wikipedia entry that indicates that it concerns a programming language) and it is sufficiently popular (more than 5,000 hits for +" programming" for Google), then please write an e-mail to tpci@tiobe.com.

  • Q: I would like to have the complete data set of the TIOBE index. Is this possible?

    A: We spent a lot of effort to obtain all the data and keep the TIOBE index up to date. In order to compensate a bit for this, we ask a fee of 5,000 US$ for the complete data set. The data set runs from June 2001 till today. It started with 25 languages back in 2001, and now measures more than 150 languages once a month. The data are available in comma separated format. Please contact sales@tiobe.com for more information.

  • Q: Why is the maximum taken to calculate the ranking for a grouping, why not the sum?

    A: Well, you can do it either way and both are wrong. If you take the sum, then you get the intersection twice. If you take the max, then you miss the difference. Which one to choose? Suppose somebody comes up with a new search term that is 10% of the original. If you take the max, nothing changes. If you take the sum then the ratings will rise 10%. So taking the sum will be an incentive for some to come up with all kinds of obscure terms for a language. That's why we decided to take the max.

    The proper way to solve this is is of course to take the sum and subtract the intersection. This will give rise to an explosion of extra queries that must be performed. Suppose a language has a grouping of 15 terms, then you have to perform 32,768 queries (all combinations of intersections). So this seems not possible either... If somebody has a solution for this, please let us know.

  • Q: What happened to Java in April 2004? Did you change your methodology?

    A: No, we did not change our methodology at that time. Google changed its methodology. They performed a general sweep action to get rid of all kinds of web sites that had been pushed up. As a consequence, there was a huge drop for languages such as Java and C++. In order to minimize such fluctuations in the future, we added two more search engines (MSN and Yahoo) a few months after this incident.

  • Q: Why is YouTube used as a search engine for the TIOBE index?

    A: First of all, YouTube counts for less than 10% of all ratings, so it has hardly any influence on the index. YouTube has been added as an experiment. It qualified for the TIOBE index because of its high ranking on Alexa. YouTube is a young platform (so an indicator for popularity) and there are quite some lectures, presentations, programming tips and language introductions available on YouTube.


Python Dejavu 详细介绍

Dejavu 是一个 Python 库,用于音频指纹和识别的算法。Dejavu 听一次音频后就会记录该音频的指纹信息,然后可通过麦克风对输入的音频进行识别是否同一首歌。


Python (发音:[ 'paiθ(ə)n; (US) 'paiθɔn ]n.蟒蛇,巨蛇 ),是一种面向对象的解释性的计算机程序设计语言,也是一种功能强大而完善的通用型语言,已经具有十多年的发展历史,成熟且稳定。Python 具有脚本语言中最丰富和强大的类库,足以支持绝大多数日常应用。

Python 语言的特点:

简单————Python是一种代表简单主义思想的语言。阅读一个良好的Python程序就感觉像是在读英语一样,尽管这个英语的要求非常严格!Python的这种伪代码本质是它最大的优点之一。它使你能够专注于解决问题而不是去搞明白语言本身。

易学————就如同你即将看到的一样,Python极其容易上手。前面已经提到了,Python有极其简单的语法。

免费、开源————Python是FLOSS(自由/开放源码软件)之一。简单地说,你可以自 由地发布这个软件的拷贝、阅读它的源代码、对它做改动、把它的一部分用于新的自由软件中。FLOSS是基于一个团体分享知识的概念。这是为什么 Python如此优秀的原因之一——它是由一群希望看到一个更加优秀的Python的人创造并经常改进着的。

高层语言————当你用Python语言编写程序的时候,你无需考虑诸如如何管理你的程序使用的内存一类的底层细节。

可移植性————由于它的开源本质,Python已经被移植在许多平台上(经过改动使它能够工 作在不同平台上)。如果你小心地避免使用依赖于系统的特性,那么你的所有Python程序无需修改就可以在下述任何平台上面运行。这些平台包括 Linux、Windows、FreeBSD、Macintosh、Solaris、OS/2、Amiga、AROS、AS/400、BeOS、OS /390、z/OS、Palm OS、QNX、VMS、Psion、Acom RISC OS、VxWorks、PlayStation、Sharp Zaurus、Windows CE甚至还有PocketPC和Symbian!

解释性————这一点需要一些解释。一个用编译性语言比如C或C++写的程序可以从源文件(即 C或C++语言)转换到一个你的计算机使用的语言(二进制代码,即0和1)。这个过程通过编译器和不同的标记、选项完成。当你运行你的程序的时候,连接/ 转载器软件把你的程序从硬盘复制到内存中并且运行。而Python语言写的程序不需要编译成二进制代码。你可以直接从源代码 运行 程序。在计算机内部,Python解释器把源代码转换成称为字节码的中间形式,然后再把它翻译成计算机使用的机器语言并运行。事实上,由于你不再需要担心 如何编译程序,如何确保连接转载正确的库等等,所有这一切使得使用Python更加简单。由于你只需要把你的Python程序拷贝到另外一台计算机上,它 就可以工作了,这也使得你的Python程序更加易于移植。

面向对象————Python即支持面向过程的编程也支持面向对象的编程。在“面向过程”的语 言中,程序是由过程或仅仅是可重用代码的函数构建起来的。在“面向对象”的语言中,程序是由数据和功能组合而成的对象构建起来的。与其他主要的语言如 C++和Java相比,Python以一种非常强大又简单的方式实现面向对象编程。

可扩展性————如果你需要你的一段关键代码运行得更快或者希望某些算法不公开,你可以把你的部分程序用C或C++编写,然后在你的Python程序中使用它们。

可嵌入性————你可以把Python嵌入你的C/C++程序,从而向你的程序用户提供脚本功能。

丰富的库————Python标准库确实很庞大。它可以帮助你处理各种工作,包括正则表达式、 文档生成、单元测试、线程、数据库、网页浏览器、CGI、FTP、电子邮件、XML、XML-RPC、HTML、WAV文件、密码系统、GUI(图形用户 界面)、Tk和其他与系统有关的操作。记住,只要安装了Python,所有这些功能都是可用的。这被称作Python的“功能齐全”理念。除了标准库以 外,还有许多其他高质量的库,如wxPython、Twisted和Python图像库等等。

概括————Python确实是一种十分精彩又强大的语言。它合理地结合了高性能与使得编写程序简单有趣的特色。

[此简介内容来自百度百科: http://baike.baidu.com/view/21087.htm]

python3在线文档:http://tool.oschina.net/apidocs/apidoc?api=Python%2Freference

python2.7在线文档:http://tool.oschina.net/apidocs/apidoc?api=python2.7.3