Lee, Kwan wrote:
>Hi,
>
>I am trying to display some change in a drawingArea when I receive a message
>from the network. There's a separate thread that retrieves message from the
>network... but for some reason even though I keep on receiving messages the
>display in drawing area does not change. what can I do about this? If I
>keep on tapping on the screen (it's ipaq, with touch screen) the display
>gets updated.
>
>Any suggestions would be greatly appreciated.
>
First, make sure that your pygtk has been compiled with threading
support. This should happen automatically if python was compiled with
threading (which happens by default with all versions released this
millenium).
Given that you will also want to redraw if the window becomes covered
and exposed, you should have a handler attached to the expose_event
signal of the drawing area. That handler should be capable of
completely redrawing the contents of the drawing area.
When you get information over the network, you simply have to update the
state the expose_event handler uses to draw, and queue a redraw of the
area. This is done by acquiring the gdk lock, then calling the drawing
area's queue_draw() method:
gtk.threads_enter()
# update state used to paint drawing area
drawingarea.queue_draw()
gtk.threads_leave()
James.
--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk