Creating a Python program

From the File menu in Wing, select New. A new tabbed editor pane appears. Type in the code shown below: (Screenshot of Hello World program in Wing 101)

Next, before we run the program, we should save it.

  1. To save a file, you can go to the File menu and select Save, or use the disk icon on the toolbar, or just press Ctrl-S.
  2. A Save dialog comes up. Don't click Save yet!. The default location is in the Python installation directory of the local machine. We need to change that.
  3. In the Save dialog, click the down-arrow next to the text box at the top and navigate to your U: drive, as shown below.
  4. Go to the folder cs127 that you created earlier.
  5. For the file name, type hello.py. You can use any name you want, but it is important to include the extension ".py".
  6. Finally, click Save.
(Screenshot of Save dialog in Wing 101)

Running your first program

To run, make sure the script you want to run is the active tab (at this moment we should have only one tab, so that's easy). Then click the green "Play" button in the top toolbar. You should see the output in the shell, as in the screenshot at the top.

Congratulations! You are now officially a Python programmer.

Huh? This is a program?

Most applications that you have used on a computer or other device have graphical windows, menus, sounds, and so on. We call this part of an application a graphical user interface, or GUI. Creating a GUI involves a lot of (mostly) tedious work using specialized libraries and tools, but does not actually teach you very much about programming or about computer science. So in most of what we do in introductory courses, we'll just use a text console like the Python shell for input and output. We can experiment with creating windows and simple graphics once we get a few more of the basics under our collective belt.