I have a problem with ttk.Treeview in Python 3. If I try to insert an element with values ββthat contain a new line, the treeview crop element only shows the first line of text, instead of creating a multi-line element. Is there any way I can customize the TreeView to show this? I would like to avoid introducing a new class or add each new row as a child. I know that you can change the style of Treeview and, for example, set "rowheight", but different elements can have different numbers of new lines. Here is a sample code:
import tkinter as tk from tkinter import ttk root = tk.Tk() tv = ttk.Treeview(root, columns=['a','b']) values = ['one', 'one \ntwo \nthree'] tv.insert('', 'end', values=values) tv.insert('', 'end', values=values) tv.pack()
In the summary, the question arises: how to set a different line depends on the number of lines of the new line in the values ββof the elements.
source share