1

I am looking for a way to write information for my treeview in tkinter. I wrote this by using the set method but my sentences disappear when I write on the next line. I want my information for the teeeview to display when I move to the next line.

from tkinter import *
from tkinter import ttk


root =Tk()


tree = ttk.Treeview(root)
tree.insert("","0","item1",text="LANGUAGE")
tree.insert("","1","item2",text="GUI")


tree.insert("item1","1",text="Version")
tree.insert("item2","end",text="Tkinter")

tree.config(columns=("NOTE"))
tree.column("NOTE",width=300)
tree.heading("NOTE",text="Info")


tree.set("item1","NOTE","Am using python version 3.6.1 \n on windows machine  
")
tree.set("item2","NOTE","This an example Tkinter Treeview in Python, which 
is from \nttk class make sure import ttk\n also from tkinter import *")

tree.pack()
root.mainloop()

Are there any methods in treeview I can use to display this, because I want to write a lot of information for the treeview?

1 Answer 1

2

You need to increase the height of the rows so that all your text will be visible. The height of the rows can only be modified by using a style:

style = ttk.Style(root)
style.configure('my.Treeview', rowheight=50)

tree.configure(style='my.Treeview')

As far as I know, it is not possible to adjust the height of a single row.

Sign up to request clarification or add additional context in comments.

3 Comments

Really works .so if i want the sentence for only the treeview have selected to display, how Will i achieve this. Example if i select treeview language,i want the sentences for only the treeview under column to display. Then when i select treeview version only the sentences for the treeview will display without displaying sentence for other treeviews until i select it to display
I am not sure to understand what you want to do. Do you have several treeviews or do you want to see the full content of the selected item only? I don't understand what you mean when you are talking about columns. I suggest you either to edit this question with a mcve about that or to ask a new question about it.
Exactly, I have several treeview but i want to see the content of selected item only when i select it. To display only the content of selected treeview.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.