def CategoryTwo_P1(self): ButtonTime = time.time() - self.StartTime String_ButtonTime = str(ButtonTime) fileIO.WriteToFile(self.FileName, "2 " + String_ButtonTime[:1]) fileIO.AddNewLine(self.FileName) if self.CurrentGroup == 2: playsound('..//Input_Files//Sound_Effects//Correct.wav') else: playsound('..//Input_Files//Sound_Effects//Incorrect.wav') time.sleep(0.5) self.NextImage_P1() self.StartTime = time.time()
def CategoryTwo_P2(self): ButtonTime = time.time() - self.StartTime String_ButtonTime = str(ButtonTime) fileIO.WriteToFile(self.FileName, "2 " + String_ButtonTime[:1]) fileIO.AddNewLine(self.FileName) time.sleep(0.75) if self.Category3Count == 6: # 6 being the number of group_test items self.GoodbyeSet = "true" self.MainUI.destroy() else: self.NextImage_P2() self.StartTime = time.time()
def NextImage_P1(self): if self.TrialNumber < int(self.MaxTrials) -1: NewGroup = random.choice([1,2]) if NewGroup == 1: self.CurrentGroup = 1 NewImage = self.PickGroupOne() if NewImage == self.PreviousImage: # If image would be the same back-to-back, then look in other category. self.CurrentGroup = 2 NewImage = self.PickGroupTwo() ImageLoad = Image.open("..//Input_Files//Group_2//" + str(NewImage) + ".png") else: ImageLoad = Image.open("..//Input_Files//Group_1//" + str(NewImage) + ".png") else: # elif NewGroup == 2: self.CurrentGroup = 2 NewImage = self.PickGroupTwo() if NewImage == self.PreviousImage: # If image would be the same back-to-back, then look in other category. self.CurrentGroup = 1 NewImage = self.PickGroupOne() ImageLoad = Image.open("..//Input_Files//Group_1//" + str(NewImage) + ".png") else: ImageLoad = Image.open("..//Input_Files//Group_2//" + str(NewImage) + ".png") self.PreviousImage = NewImage fileIO.WriteToFile(self.FileName, str(NewImage)+" ") ImageRender = ImageTk.PhotoImage(ImageLoad) self.ImageDisplay.configure(image = ImageRender) self.ImageDisplay.image = ImageRender if self.DebugMode == "true": self.Debug.configure(text = "Image name: Group_"+str(self.CurrentGroup)+"//"+str(NewImage)) self.TrialNumber += 1 else: # elif self.TrialNumber >= int(self.MaxTrials)-1: fileIO.WriteToFile(self.FileName, "Phase 2:") fileIO.AddNewLine(self.FileName) self.PauseScreenSet = "true" self.MainUI.destroy() self.StartPhaseTwo()