This module provides an IPython console widget.
You can push variables - any python object - to the console’s interactive namespace. This provides users with an advanced way of interacting with your program. For instance, if your program has a PlotWidget or a PlotWindow, you can push a reference to these widgets to allow your users to add curves, save data to files… by using the widgets’ methods from the console.
Note
This module has a dependency on IPython and qtconsole (or ipython.qt for older versions of IPython). An ImportError will be raised if it is imported while the dependencies are not satisfied.
Basic usage example:
from silx.gui import qt
from silx.gui.console import IPythonWidget
app = qt.QApplication([])
hello_button = qt.QPushButton("Hello World!", None)
hello_button.show()
console = IPythonWidget()
console.show()
console.pushVariables({"the_button": hello_button})
app.exec_()
This program will display a console widget and a push button in two separate windows. You will be able to interact with the button from the console, for example change its text:
>>> the_button.setText("Spam spam")
An IPython interactive console is a powerful tool that enables you to work with data and plot it. See this tutorial for more information on some of the rich features of IPython.
Live IPython console widget.
| Parameters: | custom_banner – Custom welcome message to be printed at the top of the console. |
|---|
Dock Widget including a IPythonWidget inside a vertical layout.
| Parameters: |
|
|---|