Mlib and GUI not refreshing


I have been working with Mlib and networkX to create a server which listens for connections and based on the message it receives, it updates and shows a graph. These are great tools but one thing has come up: when the graph has been updated and the control goes back so listening socket.accept(), the GUI does not refresh anymore. This means that the whole GUI turns into gray if some other window is brought on top of it. Also it isn't possible to close the GUI window from the 'X' button etc. However, when a new message arrives to the server, the GUI is updated but then the refreshes are left undone until the next message and this cycle repeats over and over.

If I change my program so that after the first draw & show the program runs exit, the GUI is refreshed all the time and thus works like it should. Any suggestions? I found out that someone else had the same problem:

My system is FC4 with networkX-0.33, Mlib-0.90.0, python 2.4.3, ipython 0.7.2. I have tried TkAgg, GTKAgg and WxAgg but they all give the same result. With GTK backend even the graph doesn't show up so. Maybe ipython has something to do with this? My program doesn't have a proper GUI so only the graph is shown graphically. That is why I haven't looked at embedding Mlib stuff.

Here are two simple examples how the problem could be reproduced. The window is not refreshed until the sleep has run out.

import networkx as NX
import pylab as P
import time

from pylab import *
import time
gcf().text(0.5, 0.95, 'Distance Histograms by Category is a really long title')

Thanks for any answers or suggestions!

Tomi Hautakoski
                When I play in the sandbox, the cat covers me up!