On Thu, Oct 14, 2004 at 01:18:14PM +0159, Matthias Teege wrote:
> Moin,
> 
> I try to put long running database selections in a seperate thread
> with teh following code. But the new thread doesnt start. The app does
> run in serial order as before. Whar do I missing?
> 
> class Mlist(Thread):
>     def __init__(self, app):
>         Thread.__init__(self)
>         self.app = app
>     def run(self):
>         print "run"
>         self.app.treemodel.clear()
>         for row in self.app.ds.select(mdt.mdt):
>             tools.insert_row(self.app.treemodel, None, [row.mdt,row.sb])
>         print "end"
> 
> class appgui:
>     def __init__(self):
>         """
>     ......
>         self.list_all()
> 
>     def list_all(self):
>         mlist = Mlist(self)
>         gtk.threads_enter()
>         mlist.run()
>         gtk.threads_leave()
>         print "leave"

Well one thing you are doing wrong is calling
your thread by the run method. If you want to
launch a new thread you should use the start
method.

> app=appgui()
> gtk.threads_init()
> gtk.mainloop()

-- 
Antoon Pardon
_______________________________________________
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