OOF2: The Manual

5.3. Console

The Console Window allows arbitrary Python code to be executed. Typing Python code into the Console is just like typing it at a Python prompt in a terminal window. The Console can be opened from the Console command in any OOF2 Windows menu.

Figure 5.3. The Console Window

The Console Window

The Console Window, with examples of three of its possible applications.

The Console operates in the same Python environment that OOF2 uses to evaluate all of its inputs. This means that it's possible to define variables in the Console, like this:

>>> foo=1.23
>>> fish=3.21

and use them like this:

Naturally, all of the OOF2 modules have been imported into the Python environment in the Console, as has the Python math module. This means that the Console can be used to execute OOF2 commands as if running in text mode:

>>> OOF.Microstructure.Create_From_ImageFile(filename='K1_small.pgm')
Enter microstructure_name ['K1_small.pgm']: 'micro'
Enter height [automatic]: 
Enter width [automatic]: 
OOF.Microstructure.Create_From_ImageFile(filename='K1_small.pgm', microstructure_name='micro', height=automatic, width=automatic)

The Console can also be used as a calculator, for debugging, and for poking around in the code.