Пример #1
0
def createDefaults():
    if not os.path.isfile(consts.workdoc()):
        with open(consts.workdoc(), 'w', encoding='utf-8') as t:
            t.write(
                '0SENTENCE,1TRANSLATION,2TAGS,3LEARNED,4ATTEMPTS,5SUCCESFUL ATTEMPS,6DAY LAST ATTEMPT,7LAST ATTEMPT RESULT,8DAY TO REVIEW,9ATTEMPT STREAK,10ID,DECK11,LEVEL12,IGNORE13,LANGUAGE14'
            )
        t.close()
Пример #2
0
def setupNewLesson(deck=None, workdoc=consts.workdoc(), review=True):
    reviewPerLesson = consts.reviewPerLesson()
    newPerLesson = consts.newPerLesson()
    if review:
        selectedReview = []
        tr = findTo("review", workdoc, deck)
        sr = findTo("review")
        if not deck == None:
            if len(tr) >= reviewPerLesson:
                for i in tr:
                    if len(selectedReview) < reviewPerLesson:
                        selectedReview.append(i)
                    else:
                        for n, j in enumerate(selectedReview):
                            if convertToTime(j.split(',')[8]) > convertToTime(
                                    i.split(',')[8]):
                                if i not in selectedReview:
                                    selectedReview[n] = i
            else:
                selectedReview = tr
            return selectedReview
        else:
            if len(sr) >= reviewPerLesson:
                for i in sr:
                    if len(selectedReview) < reviewPerLesson:
                        selectedReview.append(i)
                    else:
                        for n, j in enumerate(selectedReview):
                            if convertToTime(j.split(',')[8]) > convertToTime(
                                    i.split(',')[8]):
                                if i not in selectedReview:
                                    selectedReview[n] = i
            else:
                selectedReview = sr
            return selectedReview
    else:
        selectedLearn = []
        tl = findTo("learn", workdoc, deck)
        for i in tl:
            if len(selectedLearn) < newPerLesson:
                selectedLearn.append(i)
        return selectedLearn
Пример #3
0
	def checkChanges(self):
		if self.monthEntry.get() == str(consts.month()) and self.newPerLessonEntry.get() == str(consts.newPerLesson()) and self.reviewPerlessonEntry.get() == str(consts.reviewPerLesson()) and self.workdocEntry['text'] == consts.workdoc() and self.cwdEntry['text'] == consts.cwd():
			self.saveButton['state'] = tk.DISABLED
		else:
			self.saveButton['state'] = tk.ACTIVE
Пример #4
0
		def k(self): mdir = filedialog.askopenfilename(initialfile = self.workdocEntry['text'], filetypes = (('csv files','*.csv'),)).replace("/","\\"); self.workdocEntry['text'] = mdir if mdir else consts.workdoc(); self.checkChanges()
		self.workdocBrowser = tk.Button(self, text = "Change file", command = lambda: k(self))
Пример #5
0
	def createWidgets(self):
		# [GENERAL]
		# cwd = C:\Users\Jc\Desktop\srs rus
		# month = 30
		# workdoc = C:\Users\Jc\Desktop\srs rus\sentences.csv
		# hwdoc = \history.csv
		# fname = data
		# backups = C:\Users\Jc\Desktop\srs rus\backups\
		# newperlesson = 5
		# reviewperlesson = 25

		self.cwdLabel = tk.Label(self, text = "Current working directory:")
		self.cwdLabel.grid(row = 0, column = 0)
		self.cwdEntry = tk.Label(self, text = consts.cwd())
		self.cwdEntry.grid(row = 0, column = 1)
		def f(self): mdir = filedialog.askdirectory(initialdir = self.cwdEntry['text']).replace("/","\\"); self.cwdEntry['text'] = mdir if mdir else consts.cwd(); self.checkChanges()
		self.cwdBrowser = tk.Button(self, text = "Change directory", command = lambda: f(self))
		self.cwdBrowser.grid(row = 0, column=2)

		self.workdocLabel = tk.Label(self, text = "Current workdoc:")
		self.workdocLabel.grid(row = 1, column = 0)
		self.workdocEntry = tk.Label(self, text = consts.workdoc())
		self.workdocEntry.grid(row = 1, column = 1)
		def k(self): mdir = filedialog.askopenfilename(initialfile = self.workdocEntry['text'], filetypes = (('csv files','*.csv'),)).replace("/","\\"); self.workdocEntry['text'] = mdir if mdir else consts.workdoc(); self.checkChanges()
		self.workdocBrowser = tk.Button(self, text = "Change file", command = lambda: k(self))
		self.workdocBrowser.grid(row = 1, column=2)

		self.monthLabel = tk.Label(self, text = "Month:")
		self.monthLabel.grid(row = 2, column = 0)
		self.monthEntry = tk.Entry(self, validate = 'key', validatecommand = (self.register(lambda x: x.isdigit()), '%S'))
		self.monthEntry.insert(tk.END, consts.month())
		self.monthEntry.grid(row = 2, column = 1)


		# self.hwdocLabel = tk.Label(self, text = "Current hwdoc:")
		# self.hwdocLabel.grid(row = 3, column = 0)
		# self.hwdocEntry = tk.Label(self, text = consts.hwdoc())
		# self.hwdocEntry.grid(row = 3, column = 1)


		# self.fnameLabel = tk.Label(self, text = "Current fname:")
		# self.fnameLabel.grid(row = 4, column = 0)
		# self.fnameEntry = tk.Label(self, text = consts.fname())
		# self.fnameEntry.grid(row = 4, column = 1)


		# self.backupsLabel = tk.Label(self, text = "Current backups directory:")
		# self.backupsLabel.grid(row = 5, column = 0)
		# self.backupsEntry = tk.Label(self, text = consts.backups())
		# self.backupsEntry.grid(row = 5, column = 1)


		self.newPerLessonLabel = tk.Label(self, text = "Current newPerLesson:")
		self.newPerLessonLabel.grid(row = 6, column = 0)
		self.newPerLessonEntry = tk.Entry(self, validate = 'key', validatecommand = (self.register(lambda x: x.isdigit()), '%S'))
		self.newPerLessonEntry.insert(tk.END, consts.newPerLesson())
		self.newPerLessonEntry.grid(row = 6, column = 1)


		self.reviewPerlessonLabel = tk.Label(self, text = "Current reviewPerLesson:")
		self.reviewPerlessonLabel.grid(row = 7, column = 0)
		self.reviewPerlessonEntry = tk.Entry(self, validate = 'key', validatecommand = (self.register(lambda x: x.isdigit()), '%S'))
		self.reviewPerlessonEntry.insert(tk.END, consts.reviewPerLesson())
		self.reviewPerlessonEntry.grid(row = 7, column = 1)


		self.buttonGoBack = tk.Button(self, text = "Go Back", command = self.goMainMenu)
		self.buttonGoBack.grid(row = 0, column=3)

		self.saveButton = tk.Button(self, text = "Save changes", command = self.saveChanges, state = tk.DISABLED)
		self.saveButton.grid(row = 8, columnspan = 2)

		for w in self.winfo_children():
			if isinstance(w, tk.Entry):
				w.bind('<Key>', lambda x: self.after(0, self.checkChanges))
Пример #6
0
def doLearnLesson(sentences, root, tWidget, eWidget, tagsWidget, cWidget):
    curdate = "{}/{}/{}".format(datetime.now().day,
                                datetime.now().month,
                                datetime.now().year)
    gotAnswer = False
    completed = []

    while len(sentences) > 0:
        random.shuffle(sentences)
        for n, i in enumerate(sentences):
            root.line = i.split(",")
            eWidget.delete(0, len(eWidget.get()))
            if not 'img-' in root.line[1].replace(
                    'commaChar', ',') and not 'audio-' in root.line[1].replace(
                        'commaChar', ','):
                tWidget.configure(text=root.line[1].replace("commaChar", ","),
                                  image=None)
                tWidget.unbind('<Button-1>')
            elif 'img-' in root.line[1].replace('commaChar', ','):
                imgFile = "{}\\{}\\{}\\{}\\{}\\{}".format(
                    consts.cwd(), consts.fname(), root.line[11], root.line[12],
                    consts.images(), root.line[1].replace('img-', ''))
                im = Image.open(imgFile)
                #im = im.resize(size=(50,50))
                img = ImageTk.PhotoImage(im)
                tWidget.img = img
                tWidget.configure(image=img, text='')
                tWidget.unbind('<Button-1>')
            elif 'audio-' in root.line[1].replace('commaChar', ','):
                img = ImageTk.PhotoImage(audLight)
                tWidget.img = img
                tWidget.configure(image=img, text='')

                def audPlay():
                    img = ImageTk.PhotoImage(audDark)
                    tWidget.img = img
                    tWidget.configure(image=img, text='')
                    audio.play(root.line, a=True)
                    img = ImageTk.PhotoImage(audLight)
                    tWidget.img = img
                    tWidget.configure(image=img, text='')

                tWidget.bind(
                    '<Button-1>', lambda x: threading.Thread(
                        target=audPlay, daemon=True).start())

            tagsWidget.configure(
                text=root.line[2].replace("commaChar", ",")
            ) if not root.line[2] == "none" else tagsWidget.configure(text="")

            if root.line[3] == 'no':
                cAnswerEntry = tk.Label(
                    root,
                    text=root.line[0].replace("commaChar",
                                              ",").replace(".", ""),
                    font=(lambda x: cAnswerEntry.cget('font'), 32),
                    width=50,
                    wraplength=1255)
                cAnswerEntry.grid(row=4, column=0, columnspan=2, rowspan=1)
                cWidget.set(0)
                root.update()
                if not 'audio-' in root.line[1].replace('commaChar', ','):
                    audio.preload(root.line)
                    audio.play(root.line)
                else:
                    img = ImageTk.PhotoImage(audDark)
                    tWidget.img = img
                    tWidget.configure(image=img, text='')
                    root.update()
                    audio.play(root.line, a=True)
                    img = ImageTk.PhotoImage(audLight)
                    tWidget.img = img
                    tWidget.configure(image=img, text='')
                root.line[3] = 'step0'
            else:
                cWidget.set(int(root.line[3].split("step")[1]))

            eWidget.focus()
            gotAnswer = False
            root.lineEdited = False
            userinput, time = waitForAnswer(gotAnswer, root, eWidget,
                                            root.line)
            try:
                root.editEntrytl.destroy()
            except:
                pass

            if userinput == root.line[0].lower().replace(".", ""):
                eWidget["bg"] = "lime green"
                eWidget["fg"] = "white"
                root.line[3] = "step{}".format(
                    int(root.line[3].split("step")[1]) + 1)
                cWidget.set(int(root.line[3].split("step")[1]))
                root.update()
                root.line = ','.join(root.line)
                sentences[n] = root.line
            else:
                eWidget["bg"] = "red"
                eWidget["fg"] = "white"
                root.line[3] = "no-step{}".format(
                    int(root.line[3].split("step")[1]))
                root.update()
                root.line = ','.join(root.line)
                sentences[n] = root.line

            cAnswerEntry.destroy()
            afterAnswer(eWidget, root.line.split(","), root)

            if not 'no' in root.line.split(",")[3]:
                if int(root.line.split(",")[3].split('step')[1]) == 6:
                    root.line = root.line.split(",")
                    root.line[3] = 'yes'
                    root.line[6] = curdate
                    root.line[8] = addDays(root.line)
                    root.line = ','.join(root.line)
                    completed.append(root.line)
                    del sentences[n]
            else:
                root.line = root.line.split(",")
                root.line[3] = root.line[3].split("no-")[1]
                root.line = ','.join(root.line)
                sentences[n] = root.line

    root.update()
    for widget in root.winfo_children():
        widget.destroy()
        root.update()
    text = tk.Label(root,
                    font=(lambda x: Label.cget('font'), 32),
                    text="lesson Done!")
    text.grid()
    root.update()

    mycsv.write(consts.workdoc(),
                mstr=completed,
                lesson=True,
                review=False,
                learn=True)
Пример #7
0
def findTo(r=None, workdoc=consts.workdoc(), *args):
    toReview = []
    rList = []
    lList = []
    tList = []
    curdate = datetime.strptime(
        "{}/{}/{}".format(datetime.now().day,
                          datetime.now().month,
                          datetime.now().year), "%d/%m/%Y")
    lines = mycsv.read()

    if len(args):
        if r == "review":
            for i in range(1, len(lines)):
                if lines[i].split(",")[13] == "no":
                    d = convertToTime(lines[i].split(",")[8])
                    if d <= curdate:
                        if lines[i].split(",")[11] == args[0]:
                            if lines[i].split(",")[3] == "yes":
                                toReview.append(lines[i])
        elif r == "learn":
            for i in range(1, len(lines)):
                if lines[i].split(",")[13] == 'no':
                    if lines[i].split(",")[11] == args[0]:
                        if not lines[i].split(",")[3] == "yes":
                            toReview.append(lines[i])
        elif r == "total":
            for i in range(1, len(lines)):
                if lines[i].split(",")[13] == 'no':
                    if lines[i].split(",")[11] == args[0]:
                        toReview.append(lines[i])
    else:
        if r == "review":
            for i in range(1, len(lines)):
                if lines[i].split(",")[13] == 'no':
                    d = convertToTime(lines[i].split(",")[8])
                    if d <= curdate:
                        if lines[i].split(",")[3] == "yes":
                            toReview.append(lines[i])
        elif r == "learn":
            for i in range(1, len(lines)):
                if lines[i].split(",")[13] == 'no':
                    if not lines[i].split(",")[3] == "yes":
                        toReview.append(lines[i])
        elif r == "total":
            for i in range(1, len(lines)):
                if lines[i].split(",")[13] == 'no':
                    toReview.append(lines[i])
        elif r == None:
            for i in range(1, len(lines)):
                if lines[i].split(",")[13] == 'no':
                    d = convertToTime(lines[i].split(",")[8])
                    if d <= curdate:
                        if lines[i].split(",")[3] == "yes":
                            rList.append(lines[i])

                    if not lines[i].split(",")[3] == "yes":
                        lList.append(lines[i])

                    tList.append(lines[i])
            toReview = [rList, lList, tList]
    return toReview
Пример #8
0
def doReviewLesson(sentences, root, tWidget, eWidget, tagsWidget, cWidget):
    curdate = "{}/{}/{}".format(datetime.now().day,
                                datetime.now().month,
                                datetime.now().year)
    completed = []
    uncompleted = []
    redo = []
    hissentences = []
    gotAnswer = False

    while len(sentences) > 0:
        for n, i in enumerate(sentences):
            cWidget.configure(text="{}/{}".format(
                len(completed) + 1,
                len(sentences) + len(completed) + len(uncompleted) +
                len(redo)))
            # if len(uncompleted) > 0:
            # 	if random.randint(0,4) == 1:
            # 		i = uncompleted[len(uncompleted) - 1]
            # 		n = len(uncompleted) - 1
            # 		fromUncomplete = True
            root.line = i.split(",")

            eWidget.delete(0, len(eWidget.get()))
            if not 'img-' in root.line[1].replace(
                    'commaChar', ',') and not 'audio-' in root.line[1].replace(
                        'commaChar', ','):
                tWidget.configure(text=root.line[1].replace("commaChar", ","),
                                  image=None)
                tWidget.unbind('<Button-1>')
            elif 'img-' in root.line[1].replace('commaChar', ','):
                imgFile = "{}\\{}\\{}\\{}\\{}\\{}".format(
                    consts.cwd(), consts.fname(), root.line[11], root.line[12],
                    consts.images(), root.line[1].replace('img-', ''))
                im = Image.open(imgFile)
                img = ImageTk.PhotoImage(im)
                tWidget.img = img
                tWidget.configure(image=img, text='')
                tWidget.unbind('<Button-1>')
            elif 'audio-' in root.line[1].replace('commaChar', ','):
                img = ImageTk.PhotoImage(audLight)
                tWidget.img = img
                tWidget.configure(image=img, text='')

                def audPlay():
                    img = ImageTk.PhotoImage(audDark)
                    tWidget.img = img
                    tWidget.configure(image=img, text='')
                    audio.play(root.line, a=True)
                    img = ImageTk.PhotoImage(audLight)
                    tWidget.img = img
                    tWidget.configure(image=img, text='')

                tWidget.bind(
                    '<Button-1>', lambda x: threading.Thread(
                        target=audPlay, daemon=True).start())
            tagsWidget.configure(
                text=root.line[2].replace("commaChar", ",")
            ) if not root.line[2] == "none" else tagsWidget.configure(text="")
            eWidget.focus()
            gotAnswer = False
            root.lineEdited = False

            res = waitForAnswer(gotAnswer, root, eWidget, root.line)
            userinput = res[0]
            wait = res[1]

            try:
                root.editEntrytl.destroy()
            except:
                pass

            if root.lineEdited == False:
                if userinput == root.line[0].lower().replace(".", ""):
                    eWidget["bg"] = "lime green"
                    eWidget["fg"] = "white"
                    root.update()
                    root.line[4] = str(int(root.line[4]) + 1)
                    root.line[5] = str(int(root.line[5]) + 1)
                    root.line[6] = curdate
                    root.line[7] = 'success'
                    root.line[9] = str(int(root.line[9]) + 1)
                    root.line[8] = addDays(root.line)
                    nhisline = root.line[:]
                    nhisline.append('none')
                    nhisline.append("-1")
                    nhisline.append(str(datetime.now().strftime('%H:%M:%S')))
                    nhisline.append(str(wait))
                    hissentences.append(nhisline)
                    root.line = ','.join(root.line)
                    completed.append(root.line)
                    del sentences[n]
                else:
                    eWidget["bg"] = "red"
                    eWidget["fg"] = "white"
                    root.update()
                    root.line[4] = str(int(root.line[4]) + 1)
                    root.line[6] = curdate
                    root.line[7] = 'fail'
                    root.line[8] = addDays(root.line)
                    root.line = ','.join(root.line)
                    redo.append(root.line)
                    del sentences[n]
            else:
                if root.line[13] == "no":
                    del sentences[n]
                    root.line = ','.join(root.line)
                    sentences.append(root.line)
                elif root.line[13] == "yes":
                    del sentences[n]
                    nhisline = root.line[:]
                    nhisline.append('none')
                    nhisline.append("-1")
                    nhisline.append(str(datetime.now().strftime('%H:%M:%S')))
                    nhisline.append('-1')
                    hissentences.append(nhisline)
                    root.line = ','.join(root.line)
                    completed.append(root.line)

            afterAnswer(eWidget, root.line.split(","), root)
            root.lineEdited = False

            while len(redo) > 0:
                for n, i in enumerate(redo):
                    cWidget.configure(text="{}/{}".format(
                        len(completed) + 1,
                        len(sentences) + len(completed) + len(uncompleted) +
                        len(redo)))
                    root.line = i.split(",")
                    if not 'img-' in root.line[1].replace(
                            'commaChar',
                            ',') and not 'audio-' in root.line[1].replace(
                                'commaChar', ','):
                        tWidget.configure(text=root.line[1].replace(
                            "commaChar", ","),
                                          image=None)
                        tWidget.unbind('<Button-1>')
                    elif 'img-' in root.line[1].replace('commaChar', ','):
                        imgFile = "{}\\{}\\{}\\{}\\{}\\{}".format(
                            consts.cwd(),
                            consts.fname(), root.line[11], root.line[12],
                            consts.images(), root.line[1].replace('img-', ''))
                        im = Image.open(imgFile)
                        #im = im.resize(size=(50,50))
                        img = ImageTk.PhotoImage(im)
                        tWidget.img = img
                        tWidget.configure(image=img, text='')
                        tWidget.unbind('<Button-1>')
                    elif 'audio-' in root.line[1].replace('commaChar', ','):
                        img = ImageTk.PhotoImage(audLight)
                        tWidget.img = img
                        tWidget.configure(image=img, text='')

                        def audPlay():
                            img = ImageTk.PhotoImage(audDark)
                            tWidget.img = img
                            tWidget.configure(image=img, text='')
                            audio.play(root.line, a=True)
                            img = ImageTk.PhotoImage(audLight)
                            tWidget.img = img
                            tWidget.configure(image=img, text='')

                        tWidget.bind(
                            '<Button-1>',
                            lambda x: threading.Thread(target=audPlay,
                                                       daemon=True).start())
                    gotAnswer = False

                    root.lineEdited = False
                    cAnswerEntry = tk.Label(
                        root,
                        text=root.line[0].lower().replace(".", ""),
                        font=(lambda x: cAnswerEntry.cget('font'), 32),
                        width=50,
                        wraplength=1255)
                    cAnswerEntry.grid(row=4, column=0, columnspan=2, rowspan=1)

                    res = waitForAnswer(gotAnswer, root, eWidget, root.line)
                    userinput = res[0]
                    wait = res[1] + wait

                    try:
                        root.editEntrytl.destroy()
                    except:
                        pass

                    if root.lineEdited == False:
                        if userinput == root.line[0].lower().replace(".", ""):
                            eWidget["bg"] = "lime green"
                            eWidget["fg"] = "white"
                            root.update()
                            root.line[9] = str(1)
                            root.line[8] = addDays(root.line)
                            root.line.append(str(wait))
                            root.line = ','.join(root.line)
                            uncompleted.append(root.line)
                            del redo[n]
                        else:
                            eWidget["bg"] = "red"
                            eWidget["fg"] = "white"
                            root.line = ','.join(root.line)
                            redo.append(root.line)
                            del redo[n]
                            root.update()
                    else:
                        if root.line[13] == "no":
                            del redo[n]
                            root.line = ','.join(root.line)
                            redo.append(root.line)
                        elif root.line[13] == "yes":
                            del redo[n]
                            nhisline = root.line[:]
                            nhisline.append('none')
                            nhisline.append("-1")
                            nhisline.append(
                                str(datetime.now().strftime('%H:%M:%S')))
                            nhisline.append('-1')
                            hissentences.append(nhisline)
                            root.line = ','.join(root.line)
                            completed.append(root.line)

                    afterAnswer(eWidget, root.line.split(","), root)
                    root.lineEdited = False
                    cAnswerEntry.destroy()

    while len(uncompleted) > 0:
        for n, i in enumerate(uncompleted):
            cWidget.configure(text="{}/{}".format(
                len(completed) + 1,
                len(sentences) + len(completed) + len(uncompleted)))
            root.line = i.split(",")
            if not 'img-' in root.line[1].replace(
                    'commaChar', ',') and not 'audio-' in root.line[1].replace(
                        'commaChar', ','):
                tWidget.configure(text=root.line[1].replace("commaChar", ","),
                                  image=None)
                tWidget.unbind('<Button-1>')
            elif 'img-' in root.line[1].replace('commaChar', ','):
                imgFile = "{}\\{}\\{}\\{}\\{}\\{}".format(
                    consts.cwd(), consts.fname(), root.line[11], root.line[12],
                    consts.images(), root.line[1].replace('img-', ''))
                im = Image.open(imgFile)
                #im = im.resize(size=(50,50))
                img = ImageTk.PhotoImage(im)
                tWidget.img = img
                tWidget.configure(image=img, text='')
                tWidget.unbind('<Button-1>')
            elif 'audio-' in root.line[1].replace('commaChar', ','):
                img = ImageTk.PhotoImage(audLight)
                tWidget.img = img
                tWidget.configure(image=img, text='')

                def audPlay():
                    img = ImageTk.PhotoImage(audDark)
                    tWidget.img = img
                    tWidget.configure(image=img, text='')
                    audio.play(root.line, a=True)
                    img = ImageTk.PhotoImage(audLight)
                    tWidget.img = img
                    tWidget.configure(image=img, text='')

                tWidget.bind(
                    '<Button-1>', lambda x: threading.Thread(
                        target=audPlay, daemon=True).start())
            gotAnswer = False

            root.lineEdited = False
            cAnswerEntry = tk.Label(root,
                                    text=root.line[0].lower().replace(".", ""),
                                    font=(lambda x: cAnswerEntry.cget('font'),
                                          32),
                                    width=50,
                                    wraplength=1255)
            cAnswerEntry.grid(row=4, column=0, columnspan=2, rowspan=1)

            res = waitForAnswer(gotAnswer, root, eWidget, root.line)
            userinput = res[0]
            wait = res[1]

            try:
                root.editEntrytl.destroy()
            except:
                pass

            if root.lineEdited == False:
                if userinput == root.line[0].lower().replace(".", ""):
                    eWidget["bg"] = "lime green"
                    eWidget["fg"] = "white"
                    root.update()
                    root.line[9] = str(1)
                    root.line[8] = addDays(root.line)
                    nhisline = root.line[:-1]
                    nhisline.append('none')
                    nhisline.append("-1")
                    nhisline.append(str(datetime.now().strftime('%H:%M:%S')))
                    nhisline.append(str(float(root.line[15]) + wait))
                    del root.line[15]
                    hissentences.append(nhisline)
                    root.line = ','.join(root.line)
                    completed.append(root.line)
                    del uncompleted[n]
                else:
                    eWidget["bg"] = "red"
                    eWidget["fg"] = "white"
                    root.update()
                    root.line = ','.join(root.line)
                    uncompleted.append(root.line)
                    del uncompleted[n]
            else:
                if root.line[13] == "no":
                    del uncompleted[n]
                    root.line = ','.join(root.line[:-1])
                    uncompleted.append(root.line)
                elif root.line[13] == "yes":
                    del uncompleted[n]
                    nhisline = root.line[:-1]
                    nhisline.append('none')
                    nhisline.append("-1")
                    nhisline.append(str(datetime.now().strftime('%H:%M:%S')))
                    nhisline.append('-1')
                    hissentences.append(nhisline)
                    root.line = ','.join(root.line[:-1])
                    completed.append(root.line)

            afterAnswer(eWidget, root.line.split(","), root)
            root.lineEdited = False

    root.update()
    for widget in root.winfo_children():
        widget.destroy()
        root.update()
    text = tk.Label(root,
                    font=(lambda x: Label.cget('font'), 32),
                    text="Review Done!")
    text.grid()
    root.update()

    mycsv.write(consts.workdoc(), mstr=completed, lesson=True, review=True)
    mycsv.writeHistory(hissentences, tag='review')