There are different methods to measure cognitive ability of a person. One such test is called the “Stroop Effect”. It works by measuring the delay in reaction time of subject due to disagreement between different stimuli. GUI for Cognitive Test application was used in “Mythbusters Laws of Attraction” episode to asses subjects.
Importing Modules
from tkinter import *
import random
import time
Variable Declarations
COLORS = ['red', 'green', 'yellow', 'blue', 'gold', 'purple', 'black', 'cyan']
TOTAL_QUESTIONS = 10
Shuffling Algorithm
def shuffle(li):
for i in range(len(li)):
a = random.randint(0, len(li)-1)
b = random.randint(0, len(li)-1)
li[a], li[b] = li[b], li[a]
return li
Average
def average(li):
return sum(li)/len(li)
Blue Prints
Any project starts by defining the structure of application. This structure comes from the blue print of application. A frame is an object inside “top level” window where other objects like buttons, entries or other frames can be placed. Top level windows is the main window of program. In this project we will use two frames. One for taking test and the other for displaying test results. In the main frame, buttons are required for taking input from user.The functions ‘__A’, ‘__B’, ‘__C’, ‘__D’ are event handlers. They will receive and process the inputs from buttons.
class CognitiveTest:
def __init__(self):
def frame1(self):
def frame3(self):
# These are event handlers for buttons
def __A(self):
def __B(self):
def __C(self):
def __D(self):
def __retest(self):