def trainKeyPressed(event, data): # use event.char and event.keysym if (data.selectHappy): if (event.keysym == "c"): happyFace = facial._getCameraRaw() facial.saveUserFace({data.andrewID:{"happy":happyFace}}) data.happySaveSuccess = True if (data.selectSad): if (event.keysym == "c"): sadFace = facial._getCameraRaw() facial.saveUserFace({data.andrewID:{"sad":sadFace}}) data.sadSaveSuccess = True if (data.selectAnger): if (event.keysym == "c"): angerFace = facial._getCameraRaw() facial.saveUserFace({data.andrewID:{"anger":angerFace}}) data.angerSaveSuccess = True
def trainKeyPressed(root, event, data): # use event.char and event.keysym if data.selectHappy: if event.keysym == "c": happyFace = facial._getCameraRaw() facial.saveUserFace({data.andrewID: {"happy": happyFace}}) data.happySaveSuccess = True if data.selectSad: if event.keysym == "c": sadFace = facial._getCameraRaw() facial.saveUserFace({data.andrewID: {"sad": sadFace}}) data.sadSaveSuccess = True if data.selectAngry: if event.keysym == "c": angryFace = facial._getCameraRaw() facial.saveUserFace({data.andrewID: {"angry": angryFace}}) data.angrySaveSuccess = True if event.keysym == "Escape": data.button.BACK.function(root, data)