Right to left text in tkinter

python, text, tkinter

Solution

i modified your code and it's worked!..

from tkinter import *
from tkinter.constants import *
root = Tk()
text = Text(root,,font=('Tahoma',8))#I need RTL and Right justified text!

text.tag_configure('tag-right', justify='right')
text.insert('end', 'text ' * 10, 'tag-right')
text.grid()

scrl = Scrollbar(root, command=text.yview)
text.config(yscrollcommand=scrl.set)
scrl.grid(row=0, column=1, sticky='ns')
root.mainloop()

in fact i add 2 lines code that set `justify=CENTER` for a `Text` widget fails: there is no such option for the widget.

What you want is to create a tag with the parameter `justify`. Then you can insert some text using that tag (or you can insert any text and later apply the tag to a certain region)... Good luck! :)

Problem

I'm using a RTL language and I need my text to be RTL. Is there a way to do it? And How can I justify my text? Example: ``` from tkinter import * from tkinter.constants import * root = Tk() text = Text(root,,font=('Tahoma',8))#I need RTL and Right justified text! text.grid() scrl = Scrollbar(root, command=text.yview) text.config(yscrollcommand=scrl.set) scrl.grid(row=0, column=1, sticky='ns') root.mainloop() ```

Original source

Related problems