I have a pygtk application which runs as soon as my python script is opened. Along with gtk.main() I have a thread which is started at the beginning of the script, which refreshes a gtk.TextView() instance:
def listen(self):
while True:
print "refreshing"
data = self.socket.recv(buffer_size)
if data:
self.txtBuffer.insert(self.txtBuffer.get_end_iter(), data + "\n")
print data
thread.start_new_thread(self.listen, ())
self.set_up_gui() # gtk.main()
However, when I run the program, the gui opens, but no "refreshing" text is printed, nor is any data printed when sent to the socket. I have attempted to use glib.add_idle() to thread this program, however that only runs the separate thread when the gui is idle (which is infrequent). Thank you!