Home > INTViewer > User Guide

Python Terminal

This option in the Window menu starts a Python engine, and opens a Python Terminal window at the bottom of the screen. A toolbar is also available for quicker access to the terminal.

This terminal allows you to control INTViewer using Python commands.

The button is used to execute a Python script file that you have on your disk.

The button is used to save the contents of the Python Terminal to a file. You can choose to save as either a .py or .txt file. Also, during the saving process, you can choose to save only the actual Python commands, or all of the text currently present in the Python Terminal.

The button opens up the Python API. This is one way of seeing all of the scriptable classes and methods in a quick and efficient manner.

The Python Terminal includes live auto completion of commands. This functionality can be accessed by pressing the ctrl+space keys. This can be used to quickly and easily prototype your Python scripts.

Because the auto completion is live, all commands have contextual information which allows INTViewer to propose good defaults for command arguments. For instance, if you do auto completion on a command which requires a file path, the auto completion will provide paths on your actual file system. Even more than just recognizing that a file path is needed, if for instance a seismic data path is required, only seismic datasets will be proposed for auto completion.

The Python Terminal also recognizes the tab key. If you have a partially completed command, and press tab, The terminal will do one of two things. If there is only one possible matching command, the command will be completed for you. If there are multiple options, the terminal will display all commands which begin with what you have typed so far. This shortcut works for classes, methods, and variables.

In addition to the auto completion, the Python Terminal allows you to drag and drop windows, layers, and data on to the window. This will print out all of the properties of the object dragged on to the terminal, but will also allow you to set it to a variable which can then be used as part of your Python scripting.

If you press and hold the ctrl key will performing the drag and drop, INTViewer will automatically add the variable without prompting you to do so.

Multiple objects can be drag and dropped at one time. Doing this allows you to create an array of those objects. This can make for a quick way to modify many different properties at one time, without going through every single property panel.

If you choose to use the Python engine remotely, you might need to configure the port number that this engine is accessible from. This port number can be configured in the Tools->Options->Python->Editor options.