DroidUi
a Python UI / GUI library for Android (based on SL4A and Py4A)
Install / Use
/learn @iptux/DroidUiREADME
DroidUi - a Python UI library for Android
Now Python is able to run on Android platform thanks to Scripting Layer for Android and Python for Android project. But the User Interface Facade is hard to use. Most of the time, more than one call is needed to achieve your simplest goal. And the fullShow call in FullScreenUI need a XML style layout.
But what if you want to control the layout by programming, or change the layout dynamically at run time? I need a more elegant UI library, that is why DroidUi.
Quick Start
Let's start with Hello world example,
import DroidUi # yes, you need it
layout = DroidUi.DroidUi() # layout object comes first
hello = DroidUi.Button(layout, # add this Button to the layout
text = 'Hello, DroidUi!', # set the button text
command = layout.quit) # quit the layout when button clicked
layout.mainloop() # enter mainloop
Run this example will give you a big button full of your screen, click button will quit this example.
There are mainly two kinds of object in DroidUi:
- layout objects: container of View, can be showed. (
DroidUi.DroidUi) - View objects: UI element, like View class in Android. (
DroidUi.View)
DroidUi also support showing a layout from a existing XML layout,
use DroidUi.DroidUi.fromxml() and DroidUi.DroidUi.fromfile() to get the layout object
Requirement
- an Android device.
- Scripting Layer for Android r6 or above installed.
- Python for Android r5 or above installed.
Install
- make sure adb is installed on your computer.
- connect your Android device to your computer.
- run install.bat(on Windows) or install.sh(on Linux).
- then DroidUi installed.
License
DroidUi is licensed under GPLv3 by Tommy Alex
Links
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
