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

Christopher Barker Chris.Barker at noaa.gov
Mon Mar 29 12:38:38 EDT 2010


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

OK -- if I get stuck, hopefully I can get Robin Dunn interested...

> 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.

I'm really confused as to how you can start an event loop without an App 
-- but I guess I'll dig into the code to figure that out.

> 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.
 > A 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().

Got it -- I had only seen the "-a" option in the docs, so that is what I 
was messing with.


> 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.

yup -- wx doesn't support stopping and restarting an App.


>> 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.

will do.

> 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.

yes, it can mean that.

I think I'm envisioning having a "IpythonWxApp", that would act like a 
normal wx app when run on it's own, and do special stuff when run under 
wx -- Ideally it would live with wx, but that's not too big a deal. 
Hopefully I"ll get a bit of time to try to write such a beast.

-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 at noaa.gov



More information about the IPython-dev mailing list