Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion text.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
The quick brown fox jumps over the lazy dog
10 changes: 5 additions & 5 deletions tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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()
Expand All @@ -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)