On Wednesday 02 July 2003 4:47 pm, Albert Cervera Areny wrote: > > On Wed, Jul 02, 2003 at 12:07:56PM +0200, Albert Cervera Areny wrote: > >> >> The problem is that when the event occurs the window isn't > >> > >> refreshed > >> > >> >> until I move the mouse cursor. The XML-RPC process calls the window > >> >> addEvent function (I've written) and the last thing it does is > >> > >> calling > >> > >> >> self.repaint(0) but it doesn't work. > >> >> > >> >> Does somebody have a clue of how I could solve this? > >> > > >> > Is self.update() any better? > >> > >> No. It's exactly the same > > > > I suppose that you're running the XML-RPC server at one thread and the > > graphic front-end at another. If that's the case, are you aware that you > > can't simply update the graphics from the XML-RPC thread, but only from > > the main, graphics, thread (it is, if you want immediate results)? It's > > the same you can see with Java's SWING, and others. > > Then, how could I do this? The XML-RPC server is blocking and can't think > how I could make it run in the same thread. > Another possibility would be repainting from the GUI thread, I imagine, > but I can't see how could I do this at regular intervals once the > exec_loop() function is called. Is there a way of doing the loop myself > and calling some qt function at each iteration?
What about the technique used in the semaphore.py example? Define a QCustomEvent that describes the GUI changes the XML-RPC thread wants and call QApplication.postEvent() - which is thread safe. Your main GUI thread processes the event and updates the GUI as required. Phil _______________________________________________ PyKDE mailing list [EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
