2017-01-28 2 views
1

text is not okay :'(Tkinter Étiquette avec le texte arabe

est-il un moyen de faire que le texte arabe semble exactement comment il doit être: l'exemple ci-dessous devrait ressembler à « باطو »

+1

Possible copie de [texte arabe dans TKinter] (http://stackoverflow.com/questions/37964605/arabic-text-in-tkinter) – DyZ

Répondre

0

Depuis l'écriture arabe est droite à gauche , vous pouvez utiliser les bibliothèques: https://github.com/mpcabd/python-arabic-reshaper et https://github.com/MeirKriheli/python-bidi

Quelque chose comme cela peut fonctionner:

# !/usr/bin/python3 
from tkinter import * 

import arabic_reshaper 

from tkinter import messagebox 
from bidi.algorithm import get_display 

text_to_be_reshaped = "ﺏﺎﻃﻭ" 
reshaped_text = arabic_reshaper.reshape(text_to_be_reshaped) 

bidi_text = get_display(reshaped_text) 

top = Tk() 
top.geometry("70x30") 
B = Button(top, text = bidi_text) 
B.place(x=0,y=0) 
top.mainloop() 

enter image description here