PiFace with python

Python code for PiFace products can be written in two ways, using a python interpreter shell or by writing and saving your program with a text editor.

  • Python interpreter shell

    Start a new python interpreter by typing python or python3 (depending on whether you have installed PiFace software for python or python3) into a Terminal. Type your python commands after you see the python prompt >>>. The commands will execute one by one as you enter them, unless they are contained inside control statements such as while and if.

    This is a great way to test bits of code and explore the different features of PiFace products.


  • Saved Python program

    To create a python program type
    touch yourProgramName.py

    Open this file in your favourite text editor, eg:
    leafpad yourProgramName.py

    Write your code in this file and Save it. Then run it with the command
    python yourProgramName.py