Home » Support » Index of All Documentation » Introduction for New Users » Wing IDE Tutorial »
By now Wing will have found and analysed the tutorial examples, and all the modules that are imported and used by them. This analysis process runs in the background and allows Wing to present you with better support during inspection and editing of code. With larger code bases, you may notice the CPU load from this process, but with this tutorial the analysis will happen instantaneously after the project has been configured.
The editor's auto-completer and Source Assistant are two of the most important analysis-driven tools in Wing IDE.
To try these out, double click or right-click on the file example1.py in the project panel. Also bring the Source Assistant tool to front. This is where Wing IDE shows documentation, call signature, and other information as you move around your source code or work within other tools, so it's a good idea to keep it visible while editing.
Scroll down to the bottom of example1.py and enter the following code by typing (not pasting) it into the file:
news = Re
Notice that Wing shows you a popup menu of completion options as you type. You can press tab to enter the currently selected value, or scroll around in the list with the arrow keys. When you typed "news" this completer wasn't helpful because you had not yet defined news as a symbol in your source. However, once you move on to type `` = Re``, Wing will display another completion list with ReadPythonNews highlighted. Notice that the Source Assistant updates to show call information for that function, or for whatever value is selected in the auto-completer:

Next, press the Tab key to enter the completion of ReadPythonNews and enter (. You should now have this code in your editor:
news = ReadPythonNews(
If you are used to using the Enter key for auto-completion,
add it to the Completion Keys preference.
Type Get to start entering the first argument to ReadPythonNews. You will see the Source Assistant alters its display to highlight the first argument in the call information for ReadPythonNews and adds information on the argument's completion value:

The docstring for ReadPythonNews is temporarily hidden to conserve screen space (but this can be toggled with the Show docstring during completion option in the context menu obtained by right-clicking on the surface of the Source Assistant).
Now continue entering the rest of the source line so you have the following almost-complete line of source code (the trailing ) is missing):
news = ReadPythonNews(GetItemCount()
Press enter a few times. Note that Wing IDE auto-indents the subsequent lines and adds red error indicators under them shortly after you stop typing. This indicates that there is a syntax error in your code:

Once you correct the line and complete it by typing the final ), the error indicators will be removed. You should now have this complete line of code in your file:
news = ReadPythonNews(GetItemCount())
The Source Assistant also updates as you move your insertion caret around the editor. For example, try moving onto GetItemCount. Also notice that the blue links in the Source Assistant can be used to jump to the points of definition of each symbol listed there. For variables, the link after Symbol: goes to the point of definition of that variable, while any links after Likely Type: go to the point of definition of that data type (these are the same if the symbol is a function, method, or class; we'll try the Source Assistant with more interesting code later).
To play around with these tools a bit more, enter the following two additional lines of code:
PrintAsText(news) PrintAsHTML(news)
At this point you have a complete program that can be run in the debugger. There are many other editor features worth learning, but we'll get back to those later in this tutorial.
A Note on Proxies
If you are behind a firewall and use a web proxy, you may need to alter the tutorial before it will work. In particular, set up a proxy mapping like this:
proxies = {'http': 'http://192.168.3.7:3128'}
And then add a second parameter to the urllib call that obtains the news in ReadPythonNews so it looks like this:
svc = urllib.urlopen("http://www.python.org/channews.dat", proxies=proxies)
You will of course need to set the http proxy url according to your local network's configuration. See also how to determine proxy settings.
| « 1.4. Tutorial: Setting Python Path | Table of Contents | 1.6. Tutorial: Debugging » |
