Graphics Reference
In-Depth Information
The constants.py module
This module will hold various constants that we use to represent the track attribute values;
by defining them in one place, we make sure that the attribute values are used consistently,
and we don't have to remember exactly what the values are. For example, the type attrib-
ute for the tracks layer can have the following values:
ROAD
WALKING
BIKE
HORSE
Rather than hardwiring these values every time we need them, we're going to define these
values in the constants.py module. Create this module and enter the following code
into it:
TRACK_TYPE_ROAD = "ROAD"
TRACK_TYPE_WALKING = "WALKING"
TRACK_TYPE_BIKE = "BIKE"
TRACK_TYPE_HORSE = "HORSE"
TRACK_DIRECTION_BOTH = "BOTH"
TRACK_DIRECTION_FORWARD = "FORWARD"
TRACK_DIRECTION_BACKWARD = "BACKWARD"
TRACK_STATUS_OPEN = "OPEN"
TRACK_STATUS_CLOSED = "CLOSED"
We'll be adding a few more constants as we go along, but this is enough to get us started.
Search WWH ::




Custom Search