Python kivy | Arabic text on Label text

孤街醉人 提交于 2019-12-04 05:06:59

问题


My problem when i try type arabic text My code is :

import kivy
from kivy.app import App
from kivy.uix.textinput import TextInput
class TestApp(App):
    def build(self):
        return TextInput(text='مرحبا بكم ')
myapp=TestApp()
myapp.run()

when i execute Textinput text is a some of Square


回答1:


You'll have to give the label a font that support Arabic

#option1 -- on each TextInput
TextInput:
    font_name: "path/to/a/font/that/support/arabic.ttf"

#option2 override for all TextInputs
<TextInput>:
    font_name: ...

the warning from docs says:

Warning Depending on your text provider, the font file may be ignored. However, you can mostly use this without problems. If the font used lacks the glyphs for the particular language/symbols you are using, you will see ‘[]’ blank box characters instead of the actual glyphs. The solution is to use a font that has the glyphs you need to display. For example, to display unicodechar, use a font like freesans.ttf that has the glyph.



来源:https://stackoverflow.com/questions/48013683/python-kivy-arabic-text-on-label-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!