[IPython-User] How to check that a python script is called from ipython and check if qt is enabled

Eleftherios Garyfallidis garyfallidis@gmail....
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.

Best,
Eleftherios

On Wed, Oct 24, 2012 at 4:52 PM, Eleftherios Garyfallidis <
garyfallidis@gmail.com> wrote:

>
>
> On Wed, Oct 24, 2012 at 4:07 PM, Thomas Kluyver <takowl@gmail.com> wrote:
>
>> On 24 October 2012 14:55, Matthias BUSSONNIER
>> <bussonniermatthias@gmail.com> 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.
>
>
>> Thomas
>> _______________________________________________
>> IPython-User mailing list
>> IPython-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-user
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20121024/c1af3085/attachment.html 


More information about the IPython-User mailing list