Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tkinter entry and right to left cursor

I'm trying to use tkinter to create an application that using Arabic lang. the problem is the direction of cursor always from left to right that making user confused when selecting (highlighting )Arabic text inside an entry(the selected text get reversed letters position).

enter image description here

like image 320
user2980054 Avatar asked Nov 10 '22 08:11

user2980054


1 Answers

I think that you have to check the code of Tkinter.py and see if you can tweak it (but like creating an extension and not overwriting the code), maybe if you see that you can do something about these lines:

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)

All the previous lines are in the Entry class:

class Entry(Widget, XView):
    """Entry widget which allows to display simple text."""

I don't have references of support available for Arabic writing in Python, but that doesn't meant that it doesn't exists , maybe there is some dll or plugin waiting to be uncovered.

like image 151
jenko_cp Avatar answered Nov 14 '22 21:11

jenko_cp