Hi. The threads_enter and threads_leave call should go around any calls you
make to GTK stuff, not when you create the threads..
And it is important to have them surrounding gtk.main() as well..
I think what you want is as follows.
def get_groups(self, *args):
thread.start_new_thread(self.get_groups_thread, (None, None))
def get_groups_thread(self, *args):
gtk.gdk.threads_enter()
for i in my_test.get_groups():
self.liststore1.set(self.liststore1.append(None), 0, i)
gtk.gdk.threads_leave()
def run(self):
gtk.gdk.threads_init()
gtk.gdk.threads_enter()
gtk.main()
gtk.gdk.threads_leave()
Jody Steele
Quoting "Marcus Habermehl (BMH1980)" <[EMAIL PROTECTED]>:
> Hi.
>
> I have a very big problem with threads. Here some lines from my code:
>
> def get_groups(self, *args):
> gtk.gdk.threads_enter()
> thread.start_new_thread(self.get_groups_thread, (None, None))
> gtk.gdk.threads_leave()
>
> def get_groups(self, *args):
> for i in my_test.get_groups():
> self.liststore1.set(self.liststore1.append(None), 0, i)
>
> def run(self):
> gtk.gdk.threads_init()
> gtk.main
>
> This works. But only a while! :(
>
> After some time the GUI isn't correct repainted¹. And after this the GUI
> is freezing completely.
>
> I doesn't get any errors. And I think I have understand the FAQ on
> http://www.async.com.br/faq/pygtk/ .
>
> I have try this code, too. But it has the same effect.
>
> def run(self):
> gtk.gdk.threads_init()
> gtk.gdk.threads_enter()
> gtk.main()
> gtk.gdk.threads_leave()
>
> Has anyone an idea where the problem is?
>
> greetings
> Marcus
>
> ¹ = First the scrollbars on the left are missing. After this some lines
> in the treeview are missing.
>
>
>
>
>
> ___________________________________________________________
> Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden:
> http://mail.yahoo.de
> _______________________________________________
> pygtk mailing list [email protected]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>
>
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/