From www.AA6E.net
Jump to: navigation, search

This page provides some "cookbook" help for those who want to try running Python programs in a Windows environment. Many Python programs will run without change in a Windows environment, but some will not -- particularly those that require close operating system support like soundcard operations. In case of doubt, please consult the primary web documentation for Python at Python.org.

Here's a log of how I recently installed PyHamClock in a Windows XP system (service pack 3), Installation with Vista or Windows 7 should also work, but the details may differ.

1. Go to Python.org and look for information on Python 2.x.x (e.g. 2.7.2 at this writing). The new version, Python 3.x, is not compatible with the AA6E software at this time, so please don't go there!

2. You should be able to find the Windows Installer for v. 2.7.2 or later version 2.x.x. Click on the link and select "save file". (The 2.7.2 download is about 15 MB.)

3. After download of the python-2.7.2.msi file (or similar name), use Windows Explorer to find the file -- probably in your Downloads folder. Then follow the following instructions, unless you have a particular reason to do otherwise:

  • Double click to run the installer, then click "run" if asked for permission.
  • Click "install for all users".
  • Click "next" when asked about install directory, normally C:\Python27\ or similar.
  • Click "next" when asked about customizing your installation. (Accept defaults.)
  • Wait for installation to finish. Click "finish" when done.

4. You should now have Python available from your Start menu (e.g., All Programs -> Python 2.7 -> Python (command line). There are also Python Manuals and Module Docs that explain just what you now have available.

5. Various AA6E Python programs use additional Python "modules" beyond the standard package. Most of these are available for Windows as well as Linux. They will have to be downloaded and installed into the Python system. Often, they will be provided as compressed archives in the zip, gzip, or other formats. A good free compression/decompression utility to unpack these archives is available at [http:7-zip.org 7-zip.org]. (I recommend downloading and installing this utility unless you already have an equivalent.)

6. [Not needed by PyHamClock] One Module that is sometimes needed is "PySerial" that provides an interface to the PC's serial port (or a serial port provided through a serial-USB adapter). Download this package from Sourceforge pyserial downloads. Click on the latest distribution (e.g., 2.5), the click the win32 download for Python 2.x.x (e.g., pyserial-2.5.win32.exe). A download should start, giving you the option "save file". Click that. After the download completes, you can right-clock and "open" the file (in your download folder). When asked, click "run". Click "next" several times, if you accept the defaults, then "finish" and you're done. You can verify by starting Python (command line). When you get the ">>>" prompt, type "import serial" (without quotes) followed by the Enter key, then "help(serial)" likewise. You should see the beginning of brief documentation on the serial module. (Type 'quit()' plus the Enter key to quit Python.)

  • Note that PySerial offers a degree of compatibility between Linux and Windows versions, BUT not all AA6E software has been tested under Windows.

7. Another Module (really a large library) that is used for graphic user interface is "wxPython", based on "wxWidgets". It can be downloaded and installed in a similar manner to PySerial. Go to wxpython.org. Select "Stable" under Download. Download the appropriate Unicode version that matches your computer (32 or 64 bit) and matches your version of Python (2.7). When you have downloaded the file, right-click to open (run) it. Say "OK" if you get a caution about this executable file, then click "run". Click "next" several times, then "finish". Finally, wxpython compiles its library (for efficient access) and displays its README file. Running Python (command line), you can verify by entering "import wx" and then "help(wx)".

8. Go to AA6E Software and select PyHamClock. Left click on the link for the latest version (e.g. Pyhamclock03.py). This should open the source program. We need to copy the actual Python source code into a file on your machine. Select the source text (everything in the grayed frame), Copy (ctrl-C) it, and Paste (ctrl-V) it into a new Notepad document. (You can use any ASCII text editor you like.) Save the Notepad document as PyHamClock.py in a convenient location such as your Desktop. We're almost there!

9. Files with the extension ".py" should be recognized by Windows as Python programs, and you should see a distinctive desktop icon for the file you've just created. Click (double click, probably) on this file, and PyHamClock should start up. You should see two windows. A blank "terminal" window and the smaller PyHamClock display. Probably you don't want the blank window on the screen. The best you can do is to minimize it (click the underscore button at the top right). That will put it into your task bar. If you delete the window, the clock window will also be deleted.

So, if all has gone well, you have a certified copy of PyHamClock. You are encouraged to learn a little Python programming, study the source code of the program, and experiment with changes to adapt it to your needs. You will soon understand that the "computing" part of this program (keeping track of time) is a very small part. Most of the code is concerned with creating and manipulating the graphic user interface. Alas, that is typical of a lot of modern computer software.

--Martin 3/25/2012