Interactive Python Shell


Home » Support » Index of All Documentation » Wing IDE Reference Manual »

Wing provides an integrated Python Shell for execution of commands and experimental evaluation of expressions. The version of Python used in the Python Shell, and the environment it runs with, is configured in your project using Project Properties.

This shell runs a separate Python process that is independent of the IDE and functions without regard to the state of any running debug process. In Wing Professional, the Debug Probe can be used to interact in a similar way with your debug process. For details see Interactive Debug Probe.

Convenient ways to run parts of your source code in the shell include:

Copy/Paste part of a file -- Wing will automatically adjust leading indentation so the code can be executed in the shell.

Drag and Drop part of a file -- This works like Copy/Paste.

Evaluate File in Python Shell -- This command in the Source menu will evaluate the top level of the current file in the shell.

Evaluate Selection in Python Shell -- The command in the Source menu and editor's context menu (right-click) will evaluate the current selection in the shell.

Options menu This menu in the Python Shell tool contains items for evaluating the current file or selection

In the Python Shell, the Up and Down arrow keys will traverse the history of the code you have entered and the return key will either execute the code if it is complete or prompt for another line if it is not. Ctrl-Up and Ctrl-Down will move the cursor up and down and Ctrl-Return will insert a new line character at the cursor position.

To restart the Python Shell, select Restart Shell from the Options menu in the top right of the tool. This will terminate the external Python process and restart it, clearing and resetting the state of the shell.

To save the contents of the shell, use Save a Copy in the Options menu or right-click context menu. The right-click context menu also provides items for copying and pasting text in the shell.

To preload some code into the Python Shell when it is started, you can set the PYTHONSTARTUP environment variable, as supported by the Python Shell outside of Wing IDE.

« 8.4. Browser Keyboard NavigationTable of Contents9.0. Python Shell Auto-completion »

Section Contents

9.0. Python Shell Auto-completion
9.1. Python Shell Options