0

how could I remove the last row of a liststore?

I have this code running before deleting the last row:

  iter = self.model_add.insert(0, ["Hi", "Hello", "Python", "World!"])
  iter = self.model_add.insert(1, ["Hi2", "Hello2", "Python2", "World!2"])

I'd like to remove the second one row, how can I do?

4

1 回答 1

0

你可以尝试使用

self.model_add.remove(self.model_add[-1].iter)

您需要 agtk.TreeIter删除一行。对模型进行索引(例如,使用-1以获取最后一行)为您提供 a gtk.TreeModelRow,其iter属性是gtk.TreeIter指向该行的 a 。

于 2012-10-10T20:14:13.780 回答