[pygtk] Refresh data on TreeView

Vermeersch Simon simonvermeersch at gmail.com
Fri Mar 19 01:12:45 WST 2010


2010/3/18 Julián Alarcón <alarconj at gmail.com>:
> Hi guys, I don't know if this is the right place to bother you with
> this support ask.
>
> I'm making a little app that takes data from PostgreSQL and show it on
> a TreeView. But, I need to update the data every 5 minutes, but I
> don't know how to make this. I tried some while loops but the window
> didn't appear.
>
> This is the code: http://paste.ubuntu.com/397321/
>
> And this is a little screenshot: http://i42.tinypic.com/14yaazs.jpg
>
> Thanks!
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>

You can use the gobject.timeout_add function to update your treeview.
Something like that:

def __init__(self):
    ....
    gobject.timeout_add(300000, self.refresh_treeview)

def refresh_treeview(self):
    #reload your data and refresh the treeview here
    return True


-- 
Simon Vermeersch


More information about the pygtk mailing list