Search code examples
python-3.xtkinterhebrewbidi

Hebrew with tkinter - BiDi


I'm working on a python GUI application, using tkinter, which displays text in Hebrew.

On Windows (10, python 3.6, tkinter 8.6) Hebrew strings are displayed fine.

On Linux (Ubuntu 14, both python 3.4 and 3.6, tkinter 8.6) Hebrew strings are displayed incorrectly - with no BiDi awareness - am I missing something?

I installed pybidi, and via bidi.algorithm.get_display(hebrew_string) - the strings are displayed correctly.
But then, on Windows, get_display(hebrew_string) is displayed incorrectly.

Is BiDi not supported on python-tkinter-Linux?
Must I wrap each string with get_display(string)?
Must I wrap get_display(string) with a only_on_linux(...) function?


Solution

  • I searched a bit and it is a known issue that tk/tcl uses Windows bidi support since about 2011, but their is apparently nothing equivalent on linux. Example: https://wiki.tcl.tk/3158. One answer to Python/Tkinter: Using Tkinter for RTL (right-to-left) languages like Arabic/Hebrew? has some workarounds for *nix. I am not sure about Mac support with the latest tcl/tk.

    For cross-platform work you will need a function that echoes on Windows and reverses on your Ubuntu.