Hello,

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:

http://article.gmane.org/gmane.comp.python.matplotlib.general/5550/match=ipython+gui+refresh

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.

1)
import networkx as NX
import pylab as P
import time
G=NX.Graph()
G.add_edge(1,2)
G.add_edge(2,3)
NX.draw(G)
time.sleep(5)

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

Thanks for any answers or suggestions!

Tomi Hautakoski
[EMAIL PROTECTED]
                When I play in the sandbox, the cat covers me up!

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to