Using PiFace Control And Display tools

Difficulty: medium

Use our helpful tools to allow your users to input information into your program.

Question tool for PiFace Control And Display

Have a project where you need to ask the user a question? There's a tool for that.

An example question on PiFace Control And Display
An example question on PiFace Control And Display

To ask a question on PiFace CAD's LCD screen, open a Terminal then start a python shell with the command
python3

Enter the following code to ask a question
from pifacecad.tools.question import LCDQuestion
question = LCDQuestion(question="Your question", answers=["Yes","No","Maybe"])
result = question.ask()

The user will cycle through the possible answers by flicking the rocker switch, and choose their answer by pressing the rocker switch in.

Your program will wait for the answer and the variable result will contain the index of their chosen answer. In our example this means 0 for 'Yes', 1 for 'No', and 2 for 'Maybe'.