예제 #1
0
 def InitialImage_P1(self):
   NewGroup = random.choice([1,2])
   if NewGroup == 1:
     self.CurrentGroup = 1
     ChosenImage = str(self.PickGroupOne())
     fileIO.WriteToFile(self.FileName, ChosenImage + " ")
     return "Group_1//" + ChosenImage
   else:
     self.CurrentGroup = 2
     ChosenImage = str(self.PickGroupTwo())
     fileIO.WriteToFile(self.FileName, ChosenImage + " ")
     return "Group_2//" + ChosenImage
예제 #2
0
 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()
예제 #3
0
 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()
예제 #4
0
  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()
예제 #5
0
 def NextImage_P2(self):
   if self.TestGroup == "true":
     NewGroup = random.choice([1,2,3])
   else:
     NewGroup = random.choice([1,2])
     self.TestGroup = "true"
   
   if NewGroup == 3: # Show the user an image from the test-group
     self.TestGroup = "false" # Prevent back-to-back showings
     NewImage = self.PickGroupTest()
     ImageLoad = Image.open("..//Input_Files//Group_Test//" + str(NewImage) + ".png")
     self.PreviousImage = NewImage
     self.Category3Count += 1
     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_Test//"+str(NewImage))
     
   else: # Otherwise show an image from either category 1 or 2, doesn't matter
     self.TrialNumber = 0 # TrialNumber doesn't matter when in phase 2
     self.NextImage_P1()