User manual
72
9 Analogue clock on-screen
The digital display of time on computers, that we are accustomed to today has come into fashion only in the
70's. For centuries time was displayed analogously with pointers on a dial. The boom in digital watches has
declined somewhat in recent years. We have come to realize that analogue clocks are better readable and
can be seen and read under poor weather conditions or over long distances, such as in railway stations,
much faster and clearer. The human eye detects a graphic faster than it detects numbers or letters. The
image of an analogue clock brands into short-term memory, so that even if the image is incomplete or
blurred, the brain can translate it properly. On the other hand, if a digital clock is not seen clearly, we cannot
reliably gather the displayed time.
Fig. 9.1: Analogue clock, programmed with PyGame.
This programme is designed to show how to programme a clock, while at the same time it also illustrates the
fundamental principles for the representation of analogue displays, which are not only used for clocks, but
also to represent various measured values or statistical data.
Three clock hands circle round the midpoint and indicate the hour, minute, and second. Up in the window
title a digital time display is also counting.
The programme
uhr01.py shows the depicted analogue clock on the screen:
import pygame, time
from pygame.locals import *
from math import sin, cos, radians
pygame.init()
RED = (255, 0, 0); WHITE = (255, 255, 255); BLACK = (0, 0, 0)