Re: [pygtk] Problems with threads

2005-07-06 Thread Antoon Pardon
On Sat, Jul 02, 2005 at 10:09:11PM +0200, Marcus Habermehl (BMH1980) wrote: > 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

Re: [pygtk] Problems with threads

2005-07-03 Thread jmlsteele
It does seem to be counter intuitive to block before calling gtk.main(), but thats the way pygtk has been programmed. There is an entry in the FAQ about using threads with pygtk, which explains that you have to surround main with enter/leave. I can't remember if it explains why or not. There was

Re: [pygtk] Problems with threads

2005-07-02 Thread Marcus Habermehl (BMH1980)
Hi. Yes, thanks! It seems to work. But I think it's not very usable to call gtk.gdk.thread_enter() and gtk.gdk.thread_leave() before/after mainloop _and_ in the thread block. That provides mistakes. Like my. ;) Greetings Marcus [EMAIL PROTECTED] schrieb: Hi. The threads_enter and threads

Re: [pygtk] Problems with threads

2005-07-02 Thread jmlsteele
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

[pygtk] Problems with threads

2005-07-02 Thread Marcus Habermehl (BMH1980)
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(): sel