ipython + pylab + wx/wxagg on win32/OSX

Do you think we'll be able to get the GTK/win32 setup

    > working? You probably know that platform better than
    > anybody else here, so I'm pretty useless on this one.
    > But it would be great to be able to make a final ipython
    > release before I get into the 'big cleanup', so that
    > matplotlib users on all platforms/backends can use pylab
    > happily while I work on the cleanup.

Gee, some people are never satisfied!

I was able to replicate the gtk win32 problem in the matplotlib
interactive.py, which as you know is based on Brian McErlean and John
Finlay's ASPN cookbook recipe. However, the original recipe does not
have this bug. By diffing them, I traced the problem to the call to
gtk.threads_init(). This call is required on linux and OSX, but
breaks win32. Typical. So it's a hack but at least it works in my
tests thus far.

In IPython/Shell.py on or around line 424, replace the mainloop
function with

    def mainloop(self):
        
        self.gtk.timeout_add(self.TIMEOUT, self.IP.runcode)
        if sys.platform != 'win32':
            try:
                if self.gtk.gtk_version[0] >= 2:
                    self.gtk.threads_init()
            except AttributeError:
                pass
        self.start()
        self.gtk.mainloop()
        self.join()

Incidentally, this or some other change appears to fix the GTK OSX
confirm on exit bug (the only other change here is that I call 'start'
after the threads_init call).

Thus I can happily report that with this change and the one you
included in CVS yesterday for output redirection in wx, all the
backends seem to be working across all the major platforms in ipython.

And there was much rejoicing.

JDH

Actually, yes!
Alan Isaac

···

On Thu, 09 Sep 2004, John Hunter apparently wrote:

And there was much rejoicing.

John Hunter wrote:

"Fernando" == Fernando Perez <Fernando.Perez@...179...> writes:

Gee, some people are never satisfied!

You should know me by now :slight_smile:

In IPython/Shell.py on or around line 424, replace the mainloop
function with

[...]

Great, I just put it in CVS. Many thanks!

Incidentally, this or some other change appears to fix the GTK OSX
confirm on exit bug (the only other change here is that I call 'start'
after the threads_init call).

Thus I can happily report that with this change and the one you
included in CVS yesterday for output redirection in wx, all the
backends seem to be working across all the major platforms in ipython.

And there was much rejoicing.

Indeed! So it seems like the little matrix you sent yesterday now reads:

            linux win32 OSX
     GTK* : good good good
     WX* : good good good
     TK* : good good good

:slight_smile:

I think I'm actually going to make a 0.6.4 release with these fixes, since making this functionality useful across the board is worth it IMO. After the warm reception the ipython+matplotlib combo got at scipy, it would be nice to give users something that really works across all platforms.

Again, many thanks for this: you know if it were up to me the win32 bug would have lingered forever.

Best,

f