Steps ahead!
... sorry if it was well known, but apparently you have to use the
tkagg backend if you use matplotlib in Tkinter, and I didnt know it.
So you simply do this:
import matplotlib
matplotlib.use('TkAgg') #
http://matplotlib.org/examples/
user_interfaces/embedding_in_tk.html
import pylab
(the order is important I think)
After this, your plt.show() is non-blocking!!!
One big stumbling block I discovered: the Tkagg backend could be not
installed in your system...
I solved it by a) installing tk-devel and b) reinstalling matplotlib
from source (easy_install wont do)
alessandro
On Oct 17, 10:21 am, alexxx <
alexxx.ma...@gmail.com> wrote:
> hi everybody,
>
> I am able to display my graph in the matplotlib window, but I'm
> currently facing an issue due to the fact that my program's execution
> blocks while the window created by plt.show() is open.
>
> I read a lot of advice (e.g.
https://groups.google.com/group/networkx-discuss/browse_thread/thread...)
> concerning the fact that I should use .ion() to enable interactive
> mode, but it doesnt work. I wonder (since ipython usage is often
> mentioned) if it is related to the fact that I'm developing/running it
> as an autonomous program (under Wing IDE).
>
> Anyway, this sequence
>
> plt.ion()
> nx.draw(...)
> plt.show()
>
> is non-blocking, but the opened window is empty.
>
> Instead, if I dont use plt.ion(), I get the correct graph in the
> window, byt my program's main window (in Tkinter, I failed to mention)
> stops responding.
> Dunno if it does matter, but my program is a Tkinter wiki that opens
> the graph window which shows as nodes the pages around the current
> page: I'd like to keep it open, and keep on interacting with my main
> window, while at the same time be able to use the graph window, since
> I connected to it the ability to mouseclick on it and use it as a
> hyperlink to navigate to a different page (details herehttps://
groups.google.com/group/networkx-discuss/browse_thread/thread...).