带有 tkinter 的希伯来语 - BiDi [英] Hebrew with tkinter - BiDi

查看:39
本文介绍了带有 tkinter 的希伯来语 - BiDi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 tkinter 开发 Python GUI 应用程序,该应用程序以希伯来语显示文本.

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

在 Windows (10, python 3.6, tkinter 8.6) 上,希伯来语字符串显示正常.

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

在 Linux(Ubuntu 14,python 3.4 和 3.6,tkinter 8.6)上,希伯来语字符串显示不正确 - 没有 BiDi 意识 - 我是否遗漏了什么?

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?

我安装了 pybidi,并通过 bidi.algorithm.get_display(hebrew_string) - 字符串显示正确.
但是,在 Windows 上,get_display(hebrew_string) 显示不正确.

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.

python-tkinter-Linux 不支持 BiDi 吗?
我必须用 get_display(string) 包裹每个字符串吗?
我必须用 only_on_linux(...) 函数包装 get_display(string) 吗?

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?

推荐答案

我搜索了一下,发现 tk/tcl 大约从 2011 年开始使用 Windows bidi 支持是一个已知问题,但它们在 linux 上显然没有任何等价物.示例:https://wiki.tcl.tk/3158.Python/Tkinter:将 Tkinter 用于 RTL(从右到左)语言,例如阿拉伯语/希伯来语? 有一些针对 *nix 的解决方法.我不确定 Mac 是否支持最新的 tcl/tk.

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.

对于跨平台工作,您需要一个在 Windows 上回显并在您的 Ubuntu 上反转的函数.

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

这篇关于带有 tkinter 的希伯来语 - BiDi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆