[IPython-User] How to check that a python script is called from ipython and check if qt is enabled
Wed Oct 24 10:26:15 CDT 2012
Hmm, I think I can solve my problem in a much easier way. I can create
first a QtGui.QApplication and if I get a runtime error then I assume that
the Qt event loop has started from the ipython console otherwise I continue
as is. Sorry, for the trouble.
On Wed, Oct 24, 2012 at 4:52 PM, Eleftherios Garyfallidis <
> On Wed, Oct 24, 2012 at 4:07 PM, Thomas Kluyver <email@example.com> wrote:
>> On 24 October 2012 14:55, Matthias BUSSONNIER
>> <firstname.lastname@example.org> wrote:
>> > I am especially interested to know if --gui=qt is used.
>> > Script are run in the kernel that has no notion of what frontend it is
>> > attached to.
>> Isn't the --gui option for the kernel to integrate with event loops,
>> though? So it should be possible to see it.
> Yes, --gui is for event loops as you suggest.
>> You can check if IPython is loaded by looking in sys.modules, or
>> looking for get_ipython in the builtins. I'm not sure if there's a
>> good way to check if you're called from user code in IPython
>> (inspecting the stack probably isn't a good way).
>> Thank you Thomas will give it a go.
>> IPython-User mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-User