how about
while self.lstore.iter_is_valid(iter):
        self.lstore.remove(iter)


-Chris


On Thu, 18 Nov 2004 16:06:26 +0000, Stuart Hughes <[EMAIL PROTECTED]> wrote:
> Hi everyone,
> 
> I'm reading data from a file into a gtk.ListStore.  Sometimes the number
> of rows in the file can reduce, so I want to be able to refresh the
> valid rows, and delete the remaining invalid rows so they don't show up.
> 
> After refreshing the valid rows (the data runs out), I have an iter that
> points at the first row that I need to remove.  This is what I tried:
> 
> while iter:
>       self.lstore.remove(iter)
> 
> But this just got stuck in a tight loop as iter does not seem to
> increment to the next row (possibly the pygtk2reference I have is old or
> wrong).
> 
> So I tried:
> 
> while iter:
>       iter = self.lstore.remove(iter)
> 
> But remove seems just to return True, so I get an exception.
> 
> So I tried:
> 
> while iter:
>      self.lstore.remove(iter)
>      iter = self.lstore.iter_next(iter)
> 
> This mostly works, but sometimes I get:
> 
>   GtkWarning: file gtkliststore.c: line 590 (gtk_list_store_iter_next):
> assertion `GTK_LIST_STORE (tree_model)->stamp == iter->stamp' failed
>    iter = self.lstore.iter_next(iter)
> 
> Any ideas/suggestions warmly appreciated.
> 
> Regards, Stuart
> 
> _______________________________________________
> pygtk mailing list   [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
> 


-- 
Christopher Lambacher
[EMAIL PROTECTED]
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to