<small id='HVF2Q'></small><noframes id='HVF2Q'>

    <i id='HVF2Q'><tr id='HVF2Q'><dt id='HVF2Q'><q id='HVF2Q'><span id='HVF2Q'><b id='HVF2Q'><form id='HVF2Q'><ins id='HVF2Q'></ins><ul id='HVF2Q'></ul><sub id='HVF2Q'></sub></form><legend id='HVF2Q'></legend><bdo id='HVF2Q'><pre id='HVF2Q'><center id='HVF2Q'></center></pre></bdo></b><th id='HVF2Q'></th></span></q></dt></tr></i><div id='HVF2Q'><tfoot id='HVF2Q'></tfoot><dl id='HVF2Q'><fieldset id='HVF2Q'></fieldset></dl></div>
    <tfoot id='HVF2Q'></tfoot>
      <bdo id='HVF2Q'></bdo><ul id='HVF2Q'></ul>

      <legend id='HVF2Q'><style id='HVF2Q'><dir id='HVF2Q'><q id='HVF2Q'></q></dir></style></legend>

      1. 阿拉伯语文本的 Kivy 文本输入

        时间:2023-10-10

              1. <tfoot id='v3D6T'></tfoot>
              2. <legend id='v3D6T'><style id='v3D6T'><dir id='v3D6T'><q id='v3D6T'></q></dir></style></legend>
                  <bdo id='v3D6T'></bdo><ul id='v3D6T'></ul>
                • <small id='v3D6T'></small><noframes id='v3D6T'>

                    <tbody id='v3D6T'></tbody>
                  <i id='v3D6T'><tr id='v3D6T'><dt id='v3D6T'><q id='v3D6T'><span id='v3D6T'><b id='v3D6T'><form id='v3D6T'><ins id='v3D6T'></ins><ul id='v3D6T'></ul><sub id='v3D6T'></sub></form><legend id='v3D6T'></legend><bdo id='v3D6T'><pre id='v3D6T'><center id='v3D6T'></center></pre></bdo></b><th id='v3D6T'></th></span></q></dt></tr></i><div id='v3D6T'><tfoot id='v3D6T'></tfoot><dl id='v3D6T'><fieldset id='v3D6T'></fieldset></dl></div>
                  本文介绍了阿拉伯语文本的 Kivy 文本输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试将 Kivy 的文本输入用于阿拉伯文本.我用我的文本输入设置了一个阿拉伯字体,但是当我输入输入(阿拉伯语)时,我只是得到从左到右出现的阿拉伯字母(并且它们没有连接,因为阿拉伯字母应该是相邻的彼此).

                  有没有办法让 Kivy/文本输入支持我缺少的 RTL 语言输入(尤其是阿拉伯语).

                  这是我的代码,

                  从 kivy.app 导入 App从 kivy.uix.floatlayout 导入 FloatLayoutConfig.set('图形', '宽度', '300')Config.set('图形', '高度', '500')记录器 = logging.getLogger('')从 kivy.uix.textinput 导入 TextInput类编辑器应用程序(应用程序):定义构建(自我):f = 浮动布局()textinput = TextInput(text='Hello world', font_name='DroidKufi-Regular.ttf')#导入pdb;pdb.set_trace()f.add_widget(文本输入)返回 f如果 __name__ == '__main__':EditorApp().run()

                  这段代码的结果:

                  解决方案

                  不幸的是,Kivy TextInput 对从右到左的支持是 的公开尝试.另一个封闭的:从右到左的标签支持.

                  I'm trying to use Kivy's text input for Arabic text. I have an Arabic font set up with my text input but when I type into the input (in Arabic) I just get Arabic letters appearing from left to right (and they're not connected as Arabic letters should be when they're adjacent to each other).

                  Is there a way to get Kivy/text input to support RTL languages input that I'm missing (esp Arabic).

                  Here's my code,

                  from kivy.app import App
                  from kivy.uix.floatlayout import FloatLayout
                  
                  Config.set('graphics', 'width', '300')
                  Config.set('graphics', 'height', '500')
                  
                  
                  logger = logging.getLogger('')
                  
                  from kivy.uix.textinput import TextInput
                  
                  
                  class EditorApp(App):
                      def build(self):
                          f = FloatLayout()
                          textinput = TextInput(text='Hello world', font_name='DroidKufi-Regular.ttf')
                          # import pdb; pdb.set_trace()
                  
                          f.add_widget(textinput)
                  
                          return f
                  
                  
                  if __name__ == '__main__':
                      EditorApp().run()
                  

                  The result of this code:

                  解决方案

                  Unfortunately, Kivy TextInput support for right-to-left is an open issue (checked 29/05/2015). Actually, Kivy is not supporting right-to-left not only to TextInput.

                  For static texts like labels , there is a hack by using arabic_reshaper and python-bidi (reference):

                  import arabic_reshaper
                  from bidi.algorithm import get_display
                  
                  reshaped_text = arabic_reshaper.reshape(u'اللغة العربية رائعة')
                  bidi_text = get_display(reshaped_text)
                  

                  Yet, as for TextInput with a dynamic input, you had to override most of class methods to support RTL and you will end up like implementing the whole RTL support to kivy.

                  Here is an open attempt to implement Kivy bidi support. Another closed one: Right-to-left labels support.

                  这篇关于阿拉伯语文本的 Kivy 文本输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:使用自定义小部件 kivy 下一篇:如何在 Kivy ScrollView 中滚动 GridLayout?

                  相关文章

                  最新文章

                  1. <i id='ZVZpW'><tr id='ZVZpW'><dt id='ZVZpW'><q id='ZVZpW'><span id='ZVZpW'><b id='ZVZpW'><form id='ZVZpW'><ins id='ZVZpW'></ins><ul id='ZVZpW'></ul><sub id='ZVZpW'></sub></form><legend id='ZVZpW'></legend><bdo id='ZVZpW'><pre id='ZVZpW'><center id='ZVZpW'></center></pre></bdo></b><th id='ZVZpW'></th></span></q></dt></tr></i><div id='ZVZpW'><tfoot id='ZVZpW'></tfoot><dl id='ZVZpW'><fieldset id='ZVZpW'></fieldset></dl></div>
                  2. <small id='ZVZpW'></small><noframes id='ZVZpW'>

                    1. <legend id='ZVZpW'><style id='ZVZpW'><dir id='ZVZpW'><q id='ZVZpW'></q></dir></style></legend>
                    2. <tfoot id='ZVZpW'></tfoot>
                        <bdo id='ZVZpW'></bdo><ul id='ZVZpW'></ul>