当前位置:网站首页>Kivy tutorial how to automatically load kV files
Kivy tutorial how to automatically load kV files
2022-07-03 13:21:00 【Knowledge fatness】
We can call this at will main.py file , but kv File is made up of Kivy self-loading , Therefore, it must be named after the application class . for example , If our application class is called , Should be named FooBarApp A corresponding file ( The class name is converted to lowercase , Without the suffix ). Strictly following this naming convention allows us to avoid manual loading Kivy Language file , This is undoubtedly a good thing —— Fewer lines of code lead to the same result
Combat code
Directory file
clock.kv main.py
File code
# File: main.py
from kivy.app import App
class ClockApp(App):
pass
if __name__ == '__main__':
ClockApp().run()
# File: clock.kv
BoxLayout:
orientation: 'vertical'
Label:
text: '00:00:00'
Run the project
Type... On the command line
ptyhon main.py
Running effect

边栏推荐
- DQL basic query
- Spark实战1:单节点本地模式搭建Spark运行环境
- Logseq evaluation: advantages, disadvantages, evaluation, learning tutorial
- 服务器硬盘冷迁移后网卡无法启动问题
- 18W word Flink SQL God Road manual, born in the sky
- 对业务的一些思考
- 2022-02-11 heap sorting and recursion
- 刚毕业的欧洲大学生,就能拿到美国互联网大厂 Offer?
- File uploading and email sending
- Flink SQL knows why (19): the transformation between table and datastream (with source code)
猜你喜欢

今日睡眠质量记录77分

Annotation and reflection

我的创作纪念日:五周年

刚毕业的欧洲大学生,就能拿到美国互联网大厂 Offer?

Multi table query of MySQL - multi table relationship and related exercises

OpenHarmony应用开发之ETS开发方式中的Image组件

MySQL installation, uninstallation, initial password setting and general commands of Linux

Idea full text search shortcut ctr+shift+f failure problem

The principle of human voice transformer

已解决(机器学习中查看数据信息报错)AttributeError: target_names
随机推荐
MySQL installation, uninstallation, initial password setting and general commands of Linux
MySQL constraints
Logback 日志框架
正则表达式
8皇后问题
Anan's doubts
高效能人士的七个习惯
Logback 日志框架
今日睡眠质量记录77分
Some thoughts on business
Reptile
Kivy教程之 盒子布局 BoxLayout将子项排列在垂直或水平框中(教程含源码)
用户和组命令练习
Resolved (error in viewing data information in machine learning) attributeerror: target_ names
Sitescms v3.0.2 release, upgrade jfinal and other dependencies
Kivy教程之 如何通过字符串方式载入kv文件设计界面(教程含源码)
Sword finger offer 12 Path in matrix
Setting up Oracle datagurd environment
Convolution emotion analysis task4
Task6: using transformer for emotion analysis