tkinter输入框与右到左光标
我正在尝试使用tkinter创建一个支持阿拉伯语的应用程序。问题是光标的方向总是从左到右,这让用户在选择(高亮)阿拉伯文本时感到困惑,因为选中的文本字母的位置会反转。
1 个回答
1
我觉得你需要查看一下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文件或者插件等着被发现。