user2109788
user2109788

Reputation: 1336

Add New line in pygtk Treeview

I'm using gtk treeview in one of my applications.

Application works as follows: I extract some data from logfile and add the important data to my splite database and then, I show the data in treeview by fetching the rows from the database.

Now my question is how can I add newline character, so that I can add multi-lines in the treeview cellrenderer.

I tried this by setting the cellrenderer "markup" property and then tried adding "\n" and then with the
tag. In case of "\n" it prints the "\n" as it is in the treeview cell. And gives following error if I try to add
tag.

GtkWarning: Failed to set text from markup due to error parsing markup: Unknown tag 'br' on line 1 char 18 
gtk.main() 

So how can I add multilines to a gtk treeview cell?

Thanks in advance

Upvotes: 0

Views: 329

Answers (1)

Jussi Kukkonen
Jussi Kukkonen

Reputation: 14617

With regards to automatically flowing text, CellRendererText should just do the right thing if you set wrap-width property to a value that isn't -1.

If automatic wrapping is not enough and you really need separate paragraphs, I think you may need to implement your own CellRenderer (which is not trivial) or use another container like a ListBox (where custom widgets are easy, but which will mean throwing away your treeview code...).

Upvotes: 1

Related Questions