PyLighter

dynamic code highlighter

PyLighter monitoring Tetris

PyLighter is a program that simply highlights the lines of Python source files as they are used by running code, in real time and at full speed. PyLighter is a tool for beginning programmers to experiment with the relationship between static code and dynamic program behavior. It’s also a useful tool for project demonstrations to help non-programmers understand that programs have this dual static-dynamic nature.

Installing PyLighter

[These instructions are (a lot) out of date. If you manage to get the tool working on a modern OS and modern Python, I’d love to hear about it.]

Compatibility

PyLighter was written and tested using the Ubuntu 8.04 Linux distribution and Windows Vista. We have also successfully used it under Windows XP. PyLighter should work on other versions of Unix, such as other Linux distributions or Mac OS X, but we haven’t tested that.

Prerequisite Software

PyLighter uses some software that isn’t in the default Python distribution (yet). This software must be installed before PyLighter will work.

Compatibility with other versions of the prerequisite software has not been tested, so we can’t make any promises about it.

Downloading and Setting Up PyLighter

Windows

After installing the prerequisite software, you can use the PyLighter Normal Installer to install PyLighter in Windows.

Experienced users may also download the PyLighter Source and use it by extracting the archive and running pylighter.py.

Unix/Linux

Once the prerequisite software is installed, download and extract the zip file containing the PyLighter code to a directory of your choice. From there, running PyLighter is as simple as entering the PyLighter directory and running the command python pylighter.py.

Using PyLighter

To use PyLighter, just launch PyLighter from the Start Menu (or use the Python interpreter to run pylighter.py in Unix/Linux), open the file that you want to monitor, and click the Run button. That’s it! PyLighter will launch the Python program and begin highlighting its source code as the program runs.

Multiple Files

You can open multiple files. They’ll appear in tabs. The indicator lights tell you how “hot” the code in each file is. Switch between tabs to see the code in each file being highlighted.

Super Slow Motion

Use the slowing slider in PyLighter’s toolbar to adjust the speed of the program you’re monitoring. You can run the program at full speed, slow it down through a smooth range of speeds, or stop it altogether. Once stopped, use the step button to run the program one line at a time.

People

PyLighter was designed by Michael Boland and Curt Clifton and implemented by Michael Boland. The development of PyLighter was supported, in part, by the National Science Foundation under grant CCF-0707701.

Publications

Introducing PyLighter: Dynamic Code Highlighter M. G. Boland and C. Clifton. In Fortieth SIGCSE Technical Symposium on Computer Science Education, pp. 489-493, 2009.

Full text: BolandClifton09aa.pdf

Abstract: Like a screenplay, a program is both a static artifact and instructions for a dynamic performance. This duality can keep laypeople from appreciating the complexity of software systems and can be a stumbling block for novice programmers. PyLighter lets laypeople and novice programmers perceive the relationship between static Python code and its execution. PyLighter works with everything from simple console applications to arcade-style games, and because PyLighter is easy to adopt and use, instructors can integrate it into any Python-based introductory course without changing the rest of their syllabus.