Hi guys.

So, I'm trying to read data from a database and displaying in a GtkTreeview. I used glade to design the GUI
when i click on the button (view movies) the list of movies should display as a list.

def on_btnmovies_clicked(self,widget,data=None):
        db.execute("SELECT * FROM movie")
        for title in db.fetchall():
            store.append[(title[1])] #Get the movie Titles only and add to GtkListStore

I've been looking around trying to find how to actullay display the list. I've been using Click Here to read more about GtkTreeviews

In Glade I already set the GtkTree_model for GtKTreeview to GtkListStore, called listmovies, but when I run the application, the list does not show up, not even the GtkTreeview container.

I dont get any errors.

I'm unable to find the reason why the list does not show up, anybody have suggestions?

4 Years
Discussion Span
Last Post by Zeref

I don't know how glade works, but I recently hand coded a GtkListStore, and I remember that the method treeview.add_column() must be called on each column that you want to see to correctly initialize the treeview. Can you check this in your code ?

edit: sorry, it's append_column()

Edited by Gribouillis


ok, I see GtkTreeView uses GtkTreeViewColumn to organise the data into vertical columns.

To activate GtkTreeViewColumn, I had to right click (in glade) on GtkTreeView, edit, select hierarchy tab, add a new column, give it a label, done.

I Hard coded some entires, but the text is not visible but the list does expand, seems like i'm missing something small.

edit: The only thing missing is the cell renderer, cant seem to find it it glade

Edited by Zeref: I know whats missing


Ok, I found it.

After adding a new column in GtkTreeView, right click on that column and different cell renderers will appear, I chose Text, and in the text field, choose whatever list you want from the drop down box.

My text now appears.

edit: I found the solution Here

Edited by Zeref: website

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.