1

I have developed a PyQt4 application for analysing delimited log files containing numeric data. Is there any way to easily add something like a 'console' to the application so that users can access objects and data created from the application and perform (type) arbitrary commands (using SciPy and NumPy?).

1

3 Answers 3

2

How about embedding IPython into your application?

http://ipython.org/ipython-doc/stable/interactive/reference.html#embedding

Sign up to request clarification or add additional context in comments.

Comments

2
import code

code.InteractiveInterpreter(local=locals())

Spawn the interpreter with the appropriate local variables. You probably don't want to spawn an interactive console (which you can also do) because you won't be able to do any other kinds of processing in your GUI application (though maybe you can get away with this if you use threads). Instead, you can allow the user to type in commands in some textbox, and send them to the interpreter object.

Alternatively, perhaps there is some way to make code.InteractiveConsole (not InteractiveInterpreter) thread-happy.

Comments

0

Append -i to the end of the she-bang. Like this

#!/bin/python2.7 -i
''' you code here '''

After the script finishes, there remains an interactive python.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.