[pygtk] refreshing gtk.IconView

spooky.ln at tbs-software.com spooky.ln at tbs-software.com
Sun Jul 13 23:26:24 WST 2008


hi all,
im trying write simple app for viewing my photo collection.
and now i have little problem. I want update IconView after
every
single loaded photo and not update after all photos loaded.
here`s source

from __future__ import with_statement
import threading
import gtk
import os   
gtk.gdk.threads_init()

class app(gtk.Window):
    def __init__(self):
        gtk.Window.__init__(self)
        self.set_title("spoView")
        self.set_default_size(400, 500)
        self.connect("destroy", gtk.main_quit)
        
        scroll = gtk.ScrolledWindow()
        scroll.set_border_width(2)
        scroll.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        scroll.set_policy(gtk.POLICY_AUTOMATIC,
gtk.POLICY_AUTOMATIC)
        
        thumb_view = gtk.IconView()
        model = gtk.ListStore(str, gtk.gdk.Pixbuf)
        thumb_view.set_model(model)
        thumb_view.set_text_column(0)
        thumb_view.set_pixbuf_column(1)
        thumb_view.set_columns(4)
        
        vbox = gtk.VBox()
        status = gtk.Statusbar()
        
        scroll.add(thumb_view)
        vbox.pack_start(scroll, True, True)
        vbox.pack_start(status, False, False)
        self.add(vbox)
        self.show_all()
        
        files = os.listdir("/home/spooky/Pictures/100_FUJI")
        thread = threading.RLock()
        with thread:
            for image in files:
                pixbuf =
gtk.gdk.pixbuf_new_from_file_at_size("/home/spooky/Pictures/100_FUJI/%s"
% image, 96, 96)
                model.append([image, pixbuf])
                
        status.push(0, "%s files loaded." % len(files))
        
a = app()
gtk.main()

thanks for your help.


More information about the pygtk mailing list