Tutorial: Check your Python Integration

Index of All Documentation » Wing Tutorial »

Before starting with some code, let's make sure that Wing has succeeded in finding your Python installation. Bring up the Python Shell tool now from the Tools menu. If all goes well, it should start up Python and show you the Python command prompt like this:


If this is not working, or the wrong version of Python is being used, you can point Wing in the right direction with the Python Executable setting in Project Properties, available from the toolbar and Project menu. Wing 101 does not have projects and Python environment is configured instead with Configure Python in the Edit menu.

An easy way to determine the path to use here is to start the Python you wish to use with Wing and type the following at Python's >>> prompt:

import sys

This can also be typed into the IDLE that is associated with your Python install, if IDLE is installed. On OS X this is generally the easiest way to find the correct executable to use.

You will need to Restart Shell from Options in the Python Shell tool after altering Python Executable.

Once the shell works, copy/paste or drag and drop these lines of Python code into it:

for i in range(0, 10):
    print('*' * i)

This should print a triangle as follows:


Notice that the shell removes common leading white space when blocks of code are copied into it. This is useful when trying out code from source files.

Now type something in the shell, such as:

import sys

Note that Wing offers auto-completion as you type and (in Wing Pro and Wing Personal) shows call signature and documentation information in the Source Assistant. Use the Tab key to enter a selected completion. Other keys can be set up as completing keys using the Editor > Auto-completion > Completion Keys preference.

You can create as many instances of the Python Shell tool as you wish. Each one runs in its own private process space that is kept totally separate from Wing and your debug process.