Can Android apps be written in python?

(*-*)浩
Release: 2019-07-06 09:59:03
Original
7397 people have browsed it

Writing Android APP in Python is definitely not the best choice, but it is definitely a very lazy choice, and I really don’t want to learn Java. Furthermore, in terms of programming, the only ones I know are Python and Golang (Note: Python, Golang The level is average). After a long time, I Googled the possibility of writing Android APP in Python, and it is really feasible.

Can Android apps be written in python?

We use kivy to develop Android APP. Kivy is a set of open source frameworks specially designed for cross-platform rapid application development, written in Python and Cython. It has very good support for multi-touch, which not only allows developers to quickly complete simple interactive prototype designs, but also supports code reuse and deployment. It is definitely an amazing NUI framework. (Recommended learning: Python video tutorial)

Because it is cross-platform, you only need to write the code once to generate Android and iOS APPs at the same time. It’s cool, right? .

This article will take you to write a Hello world

According to world practice, let’s say “hello”.

Create a new .py file

##导入App,然后让TestApp这个类继承
from kivy.app import App
##导入一个Button,运维有这个button,当你点击的时候才会有所反应
from kivy.uix.button importButton
###定义类,名字必须是xxxApp
class TestApp(App):
###build一个Button
def build(self):
###返回一个Button,文字内容是“Hello,kivy”
return Button(text='Hello,kivy')
##运行,因为继承了App,所以才有的run这个方法
TestApp().run()
Copy after login

The above is our Hello

Of course it doesn’t make much sense to run it on windows , this is only the first step.

For more Python related technical articles, please visit the Python Tutorial column to learn!

The above is the detailed content of Can Android apps be written in python?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!