<\/figure>\n<\/p>\nort kivy<\/p>\n
from kivy.app import App<\/p>\n
from kivy.uix.label import Label<\/p>\n
class MyApp(App):<\/p>\n
def build(self):<\/p>\n
return Label(text=’Hello, World!’)<\/p>\n
if __name__ == ‘__main__’:<\/p>\n
MyApp().run()<\/p>\n
“`<\/p>\n
\u8fd0\u884c\u4ee5\u4e0a\u4ee3\u7801\u5c06\u4f1a\u5f39\u51fa\u4e00\u4e2a\u7a97\u53e3\uff0c\u4e0a\u9762\u663e\u793a “Hello, World!”\u3002<\/p>\n
##### \u53d1\u5e03\u5e94\u7528<\/p>\n
Kivy \u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u6253\u5305\u6210\u5b89\u5353 APK \u6587\u4ef6\u5e76\u53d1\u5e03\u5230 Google Play Store\u3002Kivy \u63d0\u4f9b\u4e86\u4e00\u4e2a\u5de5\u5177Kivy.buildozer\uff0c\u53ef\u4ee5\u81ea\u52a8\u5316\u6784\u5efa\u548c\u6253\u5305\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n
### 2. \u4f7f\u7528 PyQT \u7684 PyQt5 Android \u8f85\u52a9\u5e93<\/p>\n
PyQT5 Android \u8f85\u52a9\u5e93\u662f PyQt5 \u7684\u4e00\u4e2a\u6269\u5c55\u5e93\uff0c\u5b83\u53ef\u4ee5\u5c06 PyQt5 \u5e94\u7528\u7a0b\u5e8f\u8f6c\u6362\u6210\u5b89\u5353\u5e94\u7528\u7a0b\u5e8f\u3002PyQt5 Android \u8f85\u52a9\u5e93\u63d0\u4f9b\u4e86\u4e00\u4e2a QAndroidService \u7c7b\u548c\u4e00\u4e9b Android \u76f8\u5173\u7684 API\uff0c\u53ef\u4ee5\u7528\u4e8e\u5b9e\u73b0\u4e0e Android \u7cfb\u7edf\u4ea4\u4e92\u3002<\/p>\n
##### \u5b89\u88c5 PyQt5 Android \u8f85\u52a9\u5e93<\/p>\n
\u4f7f\u7528 pip \u5b89\u88c5\uff1a<\/p>\n
“`<\/p>\n
pip install PyQt5-android<\/p>\n
“`<\/p>\n
##### \u521b\u5efa\u5e76\u8c03\u8bd5\u5e94\u7528\u7a0b\u5e8f<\/p>\n
\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684 PyQt5 \u7a0b\u5e8f\u7684\u4ee3\u7801\uff1a<\/p>\n
“`python<\/p>\n
import sys<\/p>\n
from PyQt5.QtWidgets import QApplication, QLabel<\/p>\n
app = QApplication(sys.argv)<\/p>\n
label = QLabel(‘Hello, PyQt5!’)<\/p>\n
label.show()<\/p>\n
sys.exit(app.exec_())<\/p>\n
“`<\/p>\n
\u53ef\u4ee5\u5728 PC \u4e0a\u8fd0\u884c\u4ee5\u4e0a\u7a0b\u5e8f\u6d4b\u8bd5 PyQt5 \u662f\u5426\u5b89\u88c5\u6210\u529f\u3002<\/p>\n
\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u5728 Android \u624b\u673a\u4e0a\u6d4b\u8bd5\u7a0b\u5e8f\u662f\u5426\u80fd\u8fd0\u884c\u3002\u4e3a\u6b64\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528 Qt for Android \u5de5\u5177\u5305\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n
1. \u5b89\u88c5 Android Studio<\/p>\n
2. \u5b89\u88c5 Android SDK \u548c NDK<\/p>\n
3. \u4e0b\u8f7d\u548c\u7f16\u8bd1 Qt Android \u5de5\u5177\u5305<\/p>\n
4. \u914d\u7f6e\u9879\u76ee\u6587\u4ef6\u5e76\u7f16\u8bd1\u5b89\u5353\u5e94\u7528\u7a0b\u5e8f<\/p>\n
\u8be6\u7ec6\u6b65\u9aa4\u53ef\u5b89\u5353APP\u5f00\u53d1<\/a>\u4ee5\u53c2\u8003 PyQt5 \u5b98\u65b9\u6587\u6863\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"PyQt \u662f\u4e00\u4e2a\u57fa\u4e8e Python \u8bed\u8a00\u7684 GUI \u6846\u67b6\uff0c\u5b83\u63d0\u4f9b\u4e86\u8bb8\u591a\u4e30\u5bcc\u7684\u7528\u6237\u754c\u9762\u63a7\u4ef6\u548c\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u4e8e\u5f00\u53d1\u5404\u79cd\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u3002\u4f46\u662f\uff0cPyQt \u5e76\u4e0d\u80fd\u76f4\u63a5\u5f00\u53d1\u5b89\u5353\u5e94\u7528\u7a0b\u5e8f\uff0c\u56e0\u4e3a\u5b89\u5353\u64cd\u4f5c\u7cfb\u7edf\u662f\u57fa\u4e8e Ja<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[13070,23271,14,72,74],"class_list":{"0":"post-16694","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-zuoapp","7":"tag-app","9":"tag-14","10":"tag-72","11":"tag-74"},"_links":{"self":[{"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/posts\/16694","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/comments?post=16694"}],"version-history":[{"count":1,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/posts\/16694\/revisions"}],"predecessor-version":[{"id":16699,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/posts\/16694\/revisions\/16699"}],"wp:attachment":[{"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/media?parent=16694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/categories?post=16694"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/tags?post=16694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}