当前位置:网站首页>Kivy教程之 盒子布局 BoxLayout将子项排列在垂直或水平框中(教程含源码)
Kivy教程之 盒子布局 BoxLayout将子项排列在垂直或水平框中(教程含源码)
2022-07-03 12:40:00 【知识大胖】
什么是BoxLayout
BoxLayout将子项排列在垂直或水平框中。
- 要将小部件放置在彼此上方/下方,请使用垂直BoxLayout
- 要将小部件彼此相邻放置,请使用水平BoxLayout。在这个例子中,我们使用 10 个像素间距的孩子;第一个按钮覆盖 70% 的水平空间,第二个按钮覆盖 30%
实战代码
from kivy.app import App
from kivy.lang import Builder
# File: clock.kv
KV = '''
BoxLayout:
orientation: 'vertical'
Label:
text: '00:00:00'
'''
class ClockApp(App):
def build(self):
return Builder.load_string(KV)
if __name__ == '__main__':
ClockApp().run()
边栏推荐
- MySQL_ JDBC
- Logback 日志框架
- 道路建设问题
- 【Colab】【使用外部数据的7种方法】
- sitesCMS v3.0.2发布,升级JFinal等依赖
- 双链笔记 RemNote 综合评测:快速输入、PDF 阅读、间隔重复/记忆
- Logback log framework
- (first) the most complete way to become God of Flink SQL in history (full text 180000 words, 138 cases, 42 pictures)
- Fabric.js 更换图片的3种方法(包括更换分组内的图片,以及存在缓存的情况)
- Flink SQL knows why (16): dlink, a powerful tool for developing enterprises with Flink SQL
猜你喜欢
用户和组命令练习
PowerPoint 教程,如何在 PowerPoint 中将演示文稿另存为视频?
【数据库原理及应用教程(第4版|微课版)陈志泊】【第三章习题】
OpenHarmony应用开发之ETS开发方式中的Image组件
(first) the most complete way to become God of Flink SQL in history (full text 180000 words, 138 cases, 42 pictures)
IDEA 全文搜索快捷键Ctr+Shift+F失效问题
[email protected]奇安信:透视俄乌网络战 —— 网络空间基础设施面临的安全对抗与制裁博弈..."/>
开始报名丨CCF C³[email protected]奇安信:透视俄乌网络战 —— 网络空间基础设施面临的安全对抗与制裁博弈...
Flink SQL knows why (16): dlink, a powerful tool for developing enterprises with Flink SQL
sitesCMS v3.1.0发布,上线微信小程序
Idea full text search shortcut ctr+shift+f failure problem
随机推荐
Logback 日志框架
Flink SQL knows why (XIV): the way to optimize the performance of dimension table join (Part 1) with source code
PostgreSQL installation
106. How to improve the readability of SAP ui5 application routing URL
【数据库原理及应用教程(第4版|微课版)陈志泊】【第三章习题】
今日睡眠质量记录77分
Resolved (error in viewing data information in machine learning) attributeerror: target_ names
剑指 Offer 15. 二进制中1的个数
C graphical tutorial (Fourth Edition)_ Chapter 13 entrustment: what is entrustment? P238
The difference between stratifiedkfold (classification) and kfold (regression)
Annotation and reflection
Mysql database basic operation - regular expression
PowerPoint 教程,如何在 PowerPoint 中将演示文稿另存为视频?
Anan's doubts
Loan calculator my pressure is high
Sword finger offer 12 Path in matrix
开始报名丨CCF C³[email protected]奇安信:透视俄乌网络战 —— 网络空间基础设施面临的安全对抗与制裁博弈...
MySQL_ JDBC
Idea full text search shortcut ctr+shift+f failure problem
双链笔记 RemNote 综合评测:快速输入、PDF 阅读、间隔重复/记忆