Tutorial: Set Up a Project

Index of All Documentation » Wing Tutorial »

Now we're ready to get started with some coding. The first step in working with Wing is to set up a project file so that Wing can find and analyze your source code and store your work across sessions.

If you haven't already copied the tutorials directory from your Wing installation, please do so now as described in Tutorial: Getting Started.

Wing starts up initially with the Default Project. Start by creating a new project for your work on this tutorial, using Save Project As in the Project menu. Use tutorial.wpr as the project file name and place it in the tutorial directory that you created earlier.

Next, use the Add Existing Directory item in the Project menu to add your copy of the tutorials directory. Leave the default options checked so that all files in that directory are added to the project.


To make it easier to work on source code and read this tutorial at the same time, you may want to right-click on the editor tab area and select Split Side by Side.

Opening Files

Files in your project can be opened by double-clicking in the Project tool, by typing fragments into the Open From Project dialog, and in other ways that will be described later.

Try the Open From Project dialog now by using the key binding listed for it in the File menu. Type ex as the file name fragment and use the arrow keys and then Enter to open the file example1.py. Now try it again with the fragment sub ex. This matches only files with both sub and ex in their full path names. In larger projects, Open From Project is usually the easiest way to open a file.


Transient, Sticky, and Locked Files

Wing opens files in one of several modes in order to keep more relevant files open, while auto-closing others. To see this in action, right-click on os in import os at the top of example1.py and select Goto Definition. The file os.py will be opened non-sticky, so that it is automatically closed when hidden.

The mode in which a file is opened is indicated with an icon in the top right of the editor area:

stickpin-stuck - The file is sticky and will be kept open until it is closed by the user.

stickpin-unstuck - The file is non-sticky and will be kept open only while visible. When a non-sticky file is edited, it immediately converts to sticky.

stickpin-locked - The file is locked in the editor, so that the editor will not be reused to display other newly opened files. This mode is only available when multiple editor splits are present.

Clicking on the stick pin icon toggles between the available modes. Right-clicking on the icon displays a menu of recently visited files. Note that this contains both non-sticky and sticky files, while the Recent list in the File menu contains only sticky files.


The number of non-sticky editors to keep open, in addition to those that are visible, is set with the Editor > Advanced > Maximum Non-Sticky Editors preference.

This mechanism is also used in multi-file searches and other features that navigate through many files. In general you can ignore the modes and Wing will keep open the files you are actually working on, while auto-closing those that you have only visited briefly.

Shared Project Files

Wing Pro actually writes two files for each project, for example tutorial.wpr and tutorial.wpu. If you plan to use Wing projects with a revision control system such as Mercurial, Git, Subversion, or Perforce, you should check in only the *.wpr file. For details on setting up a sharable project, see Sharing Projects.