Python console support

From ASCEND
Revision as of 13:48, 13 May 2010 by UploadBot (talk | contribs) (Restored page from Google Cache, uploaded by John Pye)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
This page documents an experimental feature. You can help out by testing it and recording your experiences.

When using the PyGTK GUI, press 'F12' to access an IPython prompt. This python prompt will allow you to access various scripting functionality in ASCEND. Currently the only object added to the console's namespace is browser which corresponds to the Browser class in the file pygtk/gtkbrowser.py. Using the prompt, try the following:

To see what is broadly possible under Python at present, take a look at test.py and the .py and .h files in the pygtk directory of the source code.


M = browser.sim
M.T_amb
float(M.T_amb)
M.T_amb.setRealValue(350)
browser.modelview.refreshtree()
M.T_amb.setRealValueWithUnits(350,"R")
browser.modelview.refreshtree()

At present the GUI does not automatically update after each IPython command. We plan to fix this.

The approach used here is derived from a technique described on the IPython wiki.

We plan to improve the usability of the commands possible from the IPython console, hopefully to gradually approach the syntax of the Tcl/Tk 'Script' window.

<img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" />
Screenshot of a short IPython session within ASCEND.