kivy是一个免费、开源、跨平台的Python应用程序开发框架,编写好的程序可以直接打包为手机apk(安装包),下面我简要介绍实现的过程:
1、首先安装kivy模块,这个可以直接参考官方文档,输入对应安装命令就行,如下:
a. ensure you have the latest pip and wheel:
python -m pip install --upgrade pip wheel setuptools
b. Install the dependencies(skip gstreamer(~120MB) if not needed, see kivy’s dependencies)
python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew
python -m pip install kivy.deps.gstreamer
For the python3.5+, you can also use the angle backend instead of glew. This can be installed with:
python -m pip install kivy.deps.angle
c. Install kivy
python -m pip install kivy
d. (optional) Install kivy examples
python -m pip install kivy_examples
2、安装完成之后,可以测试一下是否安装成功代码如下,基本窗口,正中间放置一个button按钮
from kivy.app import App
from kivy.uix.button import Button
class testApp(App):
def build(self):
return Button(text='hello kivy')
testApp().run()
运行结果如下: