Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
リストストアの最後の行を削除するにはどうすればよいですか?
最後の行を削除する前に、次のコードを実行しています。
iter = self.model_add.insert(0, ["Hi", "Hello", "Python", "World!"]) iter = self.model_add.insert(1, ["Hi2", "Hello2", "Python2", "World!2"])
2番目の行を削除したいのですが、どうすればよいですか?
あなたは使用してみることができます
self.model_add.remove(self.model_add[-1].iter)
gtk.TreeIter行を削除する必要があります。モデルにインデックスを付けると(たとえば、-1最後の行を取得するために)、が得られ、gtk.TreeModelRowそのiter属性はgtk.TreeIterその行を指します。
gtk.TreeIter
-1
gtk.TreeModelRow
iter