当前位置:网站首页>Kivy tutorial: support Chinese in Kivy to build cross platform applications (tutorial includes source code)
Kivy tutorial: support Chinese in Kivy to build cross platform applications (tutorial includes source code)
2022-07-06 17:51:00 【Knowledge fatness】
This tutorial discusses Kivy Chinese is supported in , In order to use Chinese 、 Japanese and Korean UI Display text on widget .
Introduce
Kivy Is a used in Python Library for building cross platform applications in . Use the same Python file , You can create Windows、Linux、Mac、Android and iOS Applications .
By default ,Kivy Support this link https://github.com/kivy/kivy/tree/master/kivy/data/fonts Various fonts available in the project . The currently supported fonts are Roboto and DejaVu Sans. Many countries use Chinese in their official languages .
Display Chinese on the label widget
next Python The code creates a Kivy Applications , There is only one window Label The widget , Display Chinese text
import kivy.app
import kivy.uix.label
class TestApp(kivy.app.App):
def build(self):
return kivy.uix.label.Label(text=" I love tian 'anmen square in Beijing ")
testApp = TestApp()
testApp.run()
The result of running this application is shown in the following figure , The text is displayed incorrectly . It means Kivy Unable to understand these characters . Of course , The problem is that it is used in Label The font of the text displayed on the widget .

The good news is Kivy Allow to use our own fonts in UI Display text on widget . If the default Kivy Font does not support Chinese ,
边栏推荐
- EasyCVR电子地图中设备播放器loading样式的居中对齐优化
- pip install pyodbc : ERROR: Command errored out with exit status 1
- MySQL stored procedure
- What is the reason why the video cannot be played normally after the easycvr access device turns on the audio?
- [introduction to MySQL] the first sentence · first time in the "database" Mainland
- Basic configuration and use of spark
- The art of Engineering
- Compile and build, from the bottom to the top
- C # nanoframework lighting and key esp32
- Pytest learning ----- pytest confitest of interface automation test Py file details
猜你喜欢

Flink parsing (IV): recovery mechanism

Summary of Android interview questions of Dachang in 2022 (I) (including answers)

The easycvr platform reports an error "ID cannot be empty" through the interface editing channel. What is the reason?

Kali2021 installation and basic configuration

Basic configuration and use of spark

Pyspark operator processing spatial data full parsing (5): how to use spatial operation interface in pyspark

Spark accumulator and broadcast variables and beginners of sparksql

分布式不来点网关都说不过去

OliveTin能在网页上安全运行shell命令(上)

Uipath browser performs actions in the new tab
随机推荐
The art of Engineering (2): the transformation from general type to specific type needs to be tested for legitimacy
78 岁华科教授逐梦 40 载,国产数据库达梦冲刺 IPO
Chrome prompts the solution of "your company management" (the startup page is bound to the company's official website and cannot be modified)
[rapid environment construction] openharmony 10 minute tutorial (cub pie)
How to output special symbols in shell
【ASM】字节码操作 ClassWriter 类介绍与使用
Debug and run the first xv6 program
传统家装有落差,VR全景家装让你体验新房落成效果
MySQL stored procedure
开源与安全的“冰与火之歌”
SQL statement optimization, order by desc speed optimization
Establishment of graphical monitoring grafana
Xin'an Second Edition: Chapter 26 big data security demand analysis and security protection engineering learning notes
Vscode replaces commas, or specific characters with newlines
Unity小技巧 - 绘制瞄准准心
EasyCVR接入设备开启音频后,视频无法正常播放是什么原因?
Pyspark operator processing spatial data full parsing (5): how to use spatial operation interface in pyspark
FlutterWeb浏览器刷新后无法回退的解决方案
Getting started with pytest ----- test case rules
The easycvr platform reports an error "ID cannot be empty" through the interface editing channel. What is the reason?