Customizing the Python window

The Python window recognizes the system environment variable PYTHONSTARTUP. If PYTHONSTARTUP has been previously set to a Python file, Python will automatically execute that file's code when the Python window is opened. This is a useful way to ensure that your Python window experience starts with all your commonly used Python utilities preloaded.

To add the PYTHONSTARTUP environment setting, do the following:

  1. Right-click My Computer and click Properties.
  2. Click the Advanced tab and click Environment Variables.
  3. Under System variables, click New.
  4. Add PYTHONSTARTUP to Variable name.
  5. Add the path of the Python file to Variable value and click OK.
  6. Click OK.

Below is one possible startup file. If PYTHONPATH has been set to this startup file, when you open the Python window, arcpy, numpy, and time will already be imported, and the overwriteOutput setting will be turned on.

 # My startup file 
import arcpy 
from arcpy import env
import numpy 
import time 
env.overwriteOutput = True

Python window context menu

Right-click in the Python window or the Python window help and syntax pane to view the context menu for that section.

Python window context menu

Show Default Choices

When checked, code completion will provide available options.

Add To Results

When checked, tools executed in the Python window will be added to the Results window.

Load

Load an existing Python file.

Save As

Save Python window contents to a Python or text file.

Help Placement

This describes where the Help pane will be placed, relative to the main prompt.

Format

Change Python window theme and character fonts and colors.


12/15/2011