[Python-Dev] Event loops, PyOS_InputHook, and Tkinter

Fernando Perez fperez.net at gmail.com
Mon Nov 14 03:15:59 CET 2005


Michiel Jan Laurens de Hoon wrote:

> Fernando Perez wrote:

>>Did you read my reply? ipython, based on code.py, implements a few simple
>>threading tricks (they _are_ simple, since I know next to nothing about
>>threading) and gives you interactive use of PyGTK, WXPython and PyQt
>>applications in a manner similar to Tkinter.
>>
> That may be, and I think that's a good thing, but it's not up to me to
> decide if PyGtk should support interactive use. The PyGtk developers
> decide whether they want to decide to spend time on that, and they may
> decide not to, no matter how simple it may be.

OK, I must really not be making myself very clear.  I am not saying anything
aobut the pygtk developers: what I said is that this can be done by the
application writer, trivially, today.  There's nothing you need from the
authors of GTK.  Don't take my word for it, look at the code:

1. You can download ipython, it's a trivial pure-python install.  Grab
matplotlib and see for yourself (which also addresses the repaint issues you
mentioned).  You can test the gui support without mpl as well.

2. If you don't want to download/install ipython, just look at the code that
implements these features:

http://projects.scipy.org/ipython/ipython/file/ipython/trunk/IPython/Shell.py

3. If you really want to see how simple this is, you can run this single,
standalone script:

http://ipython.scipy.org/tmp/pyint-gtk.py

I wrote this when I was trying to understand the necessary threading tricks for
GTK, it's a little multithreaded GTK shell based on code.py.  230 lines of code
total, including readline support and (optional) matplotlib support.  Once this
was running, the ideas in it were folded into the more complex ipython
codebase.


At this point, I should probably stop posting on this thread.  I think this is
drifting off-topic for python-dev, and I am perhaps misunderstanding the
essence of your problem for some reason.  All I can say is that many people are
doing scientific interactive plotting with ipython/mpl and all the major GUI
toolkits, and they seem pretty happy about it.

Best,

f



More information about the Python-Dev mailing list