[IPython-dev] What is the status of iPython+wx?

Brian Granger ellisonbg@gmail....
Fri Mar 26 22:49:06 CDT 2010


Chris,

A warning: we are not GUI (or wx) experts, so it is likely you know
more about wx that we do...

> not so well -- I can start up a wx app and have a nice interactive
> command line, but there doesn't appear to be any way to re-run it.

I should say more about how the %gui magic works.  If you do:

%gui wx

All that happens is that we do what its needed to start the event
loop.  We do not in this case create a wx Application or do anything
else.  If you do this, it will be your repsonsibility to create and
manage an Application object.  BUT, don't start the event loop
yourself, it is already running.  Å warning: you may have to pass very
specific options to the wx App when you create it.  See our app
creation logic here for details of what you will likely have to do:

inputhook.InputHookManager.enable_wx

If you do:

%gui -a wx

We start the event loop AND create a wx Application passing reasonable
options.  In this case, you should not create an App, but rather just
get the one IPython created using wx.GetApp().

What I don't know is what wx does if the App gets closed down.  We
don't do anything unusual though that would mess with how wx handles
this type of thing.

> If I close the frame, then call run gui-wx.py -- it is unstable,
> freezing up on me fairly quickly.

I am guessing the App gets shutdown and that kills any further wx goodness.

> If I don't close the frame, It opens up a second frame (have you hooked
> in to have re-run wx.App.OnInit?), but then it's also unstable.

No, we don't do anything other than create the App and start the event
loop.  Are you using %gui -a or non-(-a)?

> I haven't looked yet at the ipython code to see what you are doing in
> appstart_wx. I'll try to do that soon.

Yes, also look at enable_wx.  We don't do much at all.

> Also, I found wx.App.SetExitOnFrameDelete(False) which should keep the
> app running, even when all the Windows have closed. That may end up
> being helpful.

Yes, definitely.

> Maybe appstart_wx could close all the top level windows if there is an
> app already running.

Have a look at what we are doing - it is basically \epsilon, so for
the most part wx should be doing what you tell it to.  BUT, this is
way different from the older IPython.  There we used to do a lot to
hijack/monkeypatch wx so many thing happened automagically.  but
monkeypatching = crashing.

Cheers,

Brian

>
> NOTE:
>
> Python 2.6.5
>
> IPython 0.11.alpha1.bzr.r1223
>
> OS-X 10.5 PPC
>
> -Chris
>
>
>
>
>
> --
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> Chris.Barker@noaa.gov
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>



-- 
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu
ellisonbg@gmail.com


More information about the IPython-dev mailing list