Kraken18
Kraken18

Reputation: 673

Removing a PYGTK treeview row programmatically

I'm trying to find out how you remove a row in a pygtk treeview without selecting it. I can remove rows by selecting the row first but the application I'm working on needs to be able to remove rows automatically (without the user selecting the row). As simple a feature as this seems to be I can't for the life of me figure out how to do it. I've trawled through the pygtk API and the web without success.

If anyone knows how to do this or have a link to a site that could give me a jump start on this issue, it would be greatly appreciated

Cheers

Chris

Upvotes: 2

Views: 1832

Answers (1)

Louis
Louis

Reputation: 2900

You can change the model underlying, and access any line by one of its three reference methods. Say iter is the row number :

 model = gtk.TreeView.get_model()
 model.remove(iter) 

should do the trick.

But you will be better to work immediately on the listStore without passing by the treeview, it will be easier end faster.

Upvotes: 4

Related Questions