The code is as follows:
def TrainImages():
assure_path_exists(os.path.join(SYSPATH,"TrainingImageLabel/"))
recognizer = cv2.face_LBPHFaceRecognizer.create()
faces, ID = getImagesAndLabels("TrainingImage")
try:
recognizer.train(faces, np.array(ID))
except:
mess.showwarning(title='No Registrations', message='Please Register someone first!!!')
return
recognizer.save(os.path.join(SYSPATH,"TrainingImageLabel\Trainner.yml"))
res = "Profiles Saved and trained Successfully"
instructionLabel.configure(text=res)
promptLabel.configure(text='Total Registrations Done : ' + str(max(ID)))
time.sleep(3)
displayUpdate()
In the above code, the instructionLabel.config
and promptLabel.config
are written first so they should at least be executed before sleep
but instead, the code sleeps for 3 seconds and then all of the prompts show at once. I wanted to show the Total Registration Done bit with the Profile saved prompt for 3 seconds and then overwrite those prompts with detailed info.
Is sleep
not ideal in the situation and maybe it is stopping the entire code then and there and not just the following lines from executing?