Python tkinter条目和从右向左的光标
我正在尝试使用tkinter创建一个使用阿拉伯语lang的应用程序。 问题是光标的方向总是从左向右,这使得用户在条目内选择(突出显示)阿拉伯语文本时感到困惑(所选文本的位置颠倒)Python tkinter条目和从右向左的光标,python,python-2.7,python-3.x,tkinter,Python,Python 2.7,Python 3.x,Tkinter,我正在尝试使用tkinter创建一个使用阿拉伯语lang的应用程序。 问题是光标的方向总是从左向右,这使得用户在条目内选择(突出显示)阿拉伯语文本时感到困惑(所选文本的位置颠倒) 我认为您必须检查Tkinter.py的代码,看看是否可以对其进行调整(但就像创建扩展而不覆盖代码),如果您看到可以对这些行做些什么: def get(self): """Return the text.""" return self.tk.call(self._w, 'get') def icursor
我认为您必须检查Tkinter.py的代码,看看是否可以对其进行调整(但就像创建扩展而不覆盖代码),如果您看到可以对这些行做些什么:
def get(self):
"""Return the text."""
return self.tk.call(self._w, 'get')
def icursor(self, index):
"""Insert cursor at INDEX."""
self.tk.call(self._w, 'icursor', index)
def index(self, index):
"""Return position of cursor."""
return getint(self.tk.call(
self._w, 'index', index))
def insert(self, index, string):
"""Insert STRING at INDEX."""
self.tk.call(self._w, 'insert', index, string)
def scan_mark(self, x):
"""Remember the current X, Y coordinates."""
self.tk.call(self._w, 'scan', 'mark', x)
前面的所有行都在Entry类中:
class Entry(Widget, XView):
"""Entry widget which allows to display simple text."""
我没有关于支持用Python编写阿拉伯语的参考资料,但这并不意味着它不存在,可能有一些dll或插件等着被发现。最好能看到您目前使用的代码,至少是部分代码,而不是全部代码,除非必要,为了看看这是自动的还是违背了阿拉伯语书写方法。root=Tk();en=条目(根);en.pack();root.mainloop()#简单地说就是这个代码(:它是自动的..正如你所说..但是有人在寻找解决方案,你可以尝试使用:
from bidi.algorithm import get_display;get_display(u'م
->u'!\u0645\u0644\u0627\u0639\u0644\u0627\u0627\u0628\u062d\u0631\u0645'
要在Python 2上安装:pip安装Python bidi
。相关:我认为我们需要修改'Misc class'而不是'Entry class'