diff --git a/text.txt b/text.txt index 279f658..03a79ac 100644 --- a/text.txt +++ b/text.txt @@ -2,4 +2,4 @@ Hello world my name is Tim and I am the best at making tutorials! This is another test block of text for this project! Subscribe to Tech With Tim on YouTube. Okay this is just another test to make sure the app is working okay! -The quick brown fox jumped over the rest of the sentence that I forget. \ No newline at end of file +The quick brown fox jumps over the lazy dog diff --git a/tutorial.py b/tutorial.py index dd5a8a9..5dad3a5 100644 --- a/tutorial.py +++ b/tutorial.py @@ -43,7 +43,7 @@ def wpm_test(stdscr): display_text(stdscr, target_text, current_text, wpm) stdscr.refresh() - if "".join(current_text) == target_text: + if len("".join(current_text)) == len(target_text): stdscr.nodelay(False) break @@ -52,9 +52,6 @@ def wpm_test(stdscr): except: continue - if ord(key) == 27: - break - if key in ("KEY_BACKSPACE", '\b', "\x7f"): if len(current_text) > 0: current_text.pop() @@ -73,7 +70,10 @@ def main(stdscr): stdscr.addstr(2, 0, "You completed the text! Press any key to continue...") key = stdscr.getkey() - if ord(key) == 27: + try: + if ord(key) == 27: + break + except TypeError: break wrapper(main)