Diagram of a light pen

Light enters the lens of a light pen, where it encounters a photoelectric cell, which converts the energy to a signal that is sent to the computer. The light is obtained from the refresh of the CRT, and at the instant the light is generated, the computer knows what location on the screen is being refreshed; this information is coordinated with the signal from the light pen, and is subsequently used by the graphics software to make a decision.

Source: "Understanding Computers - Computer Images", Time-Life Books, 1986. (ISBN 0-8094-5662-1)