Reputation: 379
I have a wxpython app designed using XRC which has a multiline textctrl inside nested boxlayouts.
I'm adding some text(retrieved from the web) to the text control using SetValue(), inside the longtask method from a separate thread using the following code
thread.start_new_thread(self.longtask, ())
The app runs fine the first couple of tries(text gets added correctly) but after around 3 or 4 times it exits with a segmentation fault and following warning.
(python:3341): Gtk-WARNING **: unable to find signal handler for object(GtkEntry:0x9ed89e0) with func(0x837600) and data(0x9e19c08)
Does anyone know why this is happening and how I can fix it? I'm running Python2.6 on Ubuntu 10.2.
Thanks in advance.
Upvotes: 0
Views: 217
Reputation: 273756
Directly calling methods of GUI elements from a different thread is dangerous. Without getting too much into your code, I'd recommend you to consider a robust multi-threaded design. For example, you can use Queue
objects to pass data between threads. Alternatively, use wx's events.
Here's a nice article on this issue. And a related SO discussion. Google for more ('wxpython thread')
Upvotes: 2