<[EMAIL PROTECTED]> wrote: On 26 Nov, 13:42, Steve Holden <[EMAIL PROTECTED]> wrote:
>> One approach would be to run the socket code in blocking mode in a >> separate thread started by the (main program) GUI thread at program >> startup, and communicating results back via a Queue.Queue or similar to >> the GUI thread. That thread wakes itself up once every (say) 500 mS to >> check for updates from the socket side. >> >> You should see your CPU utilization go down then. The threading.thread >> library is actually much easier to use than you would think, though it's >> possible to get things wrong by assuming data sharing will work in ways >> it actually doesn't. But if you have the main thread pass a Queue to the >> networking thread, that should be a reliable means of communication. >> > >Thankk you Steve, I have now a GUI and a threaded socket client >receiving data on its socket. I pass to it a queue object from the >GUI, but when it tries to push a value on the queue, the GUI does not >see any value. My last work with OOP is as far in time as the >beginning of Java, I'm surely missing something simple but very >important. >Anyway, the goal to have a responsive GUI and a functional socket has >been achieved, thanks again. If you have hints on the queue problem, >your help is welcome. If you are not already doing it, you need to make a "stutter thread" by using the after() call on some gui object to periodically check for input on the queue. There is a recipe for this but I have yet again lost the link. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list