Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to align text to the right in ttk Treeview widget?

I am using a ttk.Treeview widget to display a list of Arabic books. Arabic is a right-to-left language, so the text should be aligned to the right. The justify option that is available for Label and other ttk widgets does not seem to work for Treeview.

Does anyone know how to do this?

like image 928
peterv Avatar asked May 22 '15 10:05

peterv


People also ask

How do I edit a Treeview in Python?

The Treeview widget items can be edited and deleted by selecting the item using tree. selection() function. Once an item is selected, we can perform certain operations to delete or edit the item.

What is IID in Treeview?

The iid argument stands for item identifier which is unique for each item, and you can give it the value you want.

How do you change column width in Treeview?

To configure the column width of the Treeview widget, we can use the width and stretch property. It sets the width of the Treeview widget column with the given value.

What does Treeview focus do?

treeview. focus() returns the iid of a single line. The treeview box allows you to select multiple lines.


1 Answers

The ttk.Treeview widget has an anchor option you can set for each column. To set the anchor of a column to the right side use:

ttk.Treeview.column(column_id, anchor=Tkinter.E)
like image 71
fhdrsdg Avatar answered Oct 05 '22 20:10

fhdrsdg