#!/usr/bin/python

import time, sys
sys.path.append('/opt/tuxdroid/api/python')
from tux import *

# Tux speak the text   
def tux_speak(text):
    tux.cmd.mouth_open()
    tux.tts.speak(text)
    tux.cmd.mouth_close()

tux.cmd.eyes_open()
tux.cmd.leds_on()
tux.cmd.mouth_close()
tux.cmd.wings_on()

question = "Quel etait la couleur du cheval blanc d'henri 4?" # what is the color of the white horse of henri 4?
reponseA = "Blanc. " # white
reponseB = "Noir. " # black
temps = 10
A = RIGHT_WING_BT
B = LEFT_WING_BT
BonneR = A

#while (1 == 1):
tux_speak("Voici la question : " + question)
tux.cmd.ledl_off()
tux_speak("Reponse A : " + reponseA)
tux.cmd.ledl_on()
tux.cmd.ledr_off()
tux_speak("Reponse B : " + reponseB)
heure = time.clock()
tux.cmd.leds_on()
bouton = tux.event.wait_bt_pushed(temps)
if (bouton == BonneR):
	tux_speak("Bravo, c'est la bonne reponse!") # good awnser
else:
	tux.cmd.wings_on_free(6)
	tux.cmd.sound_play(8,0)
	tux_speak("C'est perdu!") # you loose

tux.cmd.eyes_open()
tux.cmd.leds_on()
tux.cmd.mouth_close()
tux.cmd.wings_on()

tux.destroy()
