dantarno
dantarno

Reputation: 92

Treeview with different number of columns GTK

I'm trying to create a Gtk.Treeview using Gtk.ListStore. As parameter of Gtk.ListStore we have to pass the type of each column:

for example to display the data

Bob 12 horse

Leo 14 frog

We must do Gtk.ListStore(str, int, str)

The issue is that my software will have different kind of data to display, always strings but a different number of column.

If I have 10 columns I must do : Gtk.ListStore(Str, str, str, str, str, str, str, str, str, str) I will have from 1 to 50 column to display.

How can I find a workaround ?

I tried Gtk.ListStore(str) to say that all column will hold string but it understand that there is only one column

Thank you

Upvotes: 0

Views: 102

Answers (1)

dantarno
dantarno

Reputation: 92

I found the solution :

Gtk.ListStore(*[str]*len(my_data))

Thanks to :

Gtk.ListStore(*datatypes) string error

Upvotes: 1

Related Questions