PiFace Control And Display train times guide

Difficulty: easy

Display the live train times from your home station to a selected list of stations, using PiFace Control And Display.

Modifying PiFace Control And Display traintimes

The defaults of the PiFace CAD train times example is great if you live in Manchester and happen to travel to the handful of stations selected as destinations, but for everyone else, you may wish to change these defaults.

So you don't lose the original program, first copy the traintimes.py example to your home directory
cp /usr/share/doc/python3-pifacecad/examples/traintimes.py ~/.

Now cd into your home directory if you were not already there.

Now open the traintimes.py file in your favourite installed text editor, eg:
leafpad traintimes.py

To add stations to the program, you will need to know their station codes. If you don't know some station codes you can find them here.

To change your home station, navigate down to the line:

Change MAN to the three letter code of your home station.
You will also need to add it to the TRAIN_STATIONS list if it is not already present, in the format:
{'name': 'Your station name here', 'code': 'your 3 letter station code here'},

{'name': 'Crewe', 'code': 'CRE'},

Be sure to separate the station entries with a comma.

Change the other stations to ones which you want to know the train times to. The stations are displayed in the same order as they appear on this list, so you may wish to reorder them based on how often you want to check certain stations.

Save your changes and exit your editor.

Now run your modified traintimes program from your home directory
python3 traintimes.py