I am quite new to GUI design and struggle to communicae with my core application.
I have a Thread that I use to run my core code. It is started when the user clicks on a start button. On the other side, I have my gui; and I would like it to be updated during the process.
My Thread currently populates a Queue, and I want to set the messages of this Queue in the status bar.
Currently, I use :
while not self.stopPull:
try:
print self.mess_queue.get() # would set my status bar
except Queue.Empty:
continue
The Thread code is really basic:
while not self.stoprequest.isSet():
bla()#some processing . . .
self.result_q.put("bla")
bla()#some other processing . . .
self.result_q.put("blabla")
Thing is, this is of course blocking . . .
So do I have to create another Thread to listen to new messages in my Queue, or is there a way to have some kind of interruptions as a new message is pulled ?
Once again, I am completely ignorant with communication process, and I must miss some basic keywords, because I couldn't find documentation on the subject on the web.
Thank you for your hel !
In order for a GUI to be non blocking, one has to use threads.
The pygtk FAQ has a part dedicated to this : http://faq.pygtk.org/index.py?req=all#20.1