-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·61 lines (43 loc) · 1.95 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/python3
# -----------------------------------------------------------------
# simple script for automate typing tests,
# in test sites.
# cheating in sites like typing racer.
# note the website that i use for this script:
# "https://www.typingpal.com/en/typing-test"
#
#
# Author:N84.
#
# Create Date:Sun Mar 6 16:36:53 2022.
# ///
# ///
# ///
# -----------------------------------------------------------------
from os import system
from os import name as os_name
from pynput.keyboard import Key, Controller
from time import sleep
def clear():
"""wipe the terminal screen"""
if os_name == "posix":
# *nix machines.
system("clear")
else:
# windows machines.
system("cls")
clear()
def typing(msg: str, delay: int = 250e-3):
"""this function will type the msg using,
the physical keyboard."""
# create the main Keyboard controller object.
keyboard = Controller()
for char in msg:
keyboard.press(char)
sleep(delay)
def main():
sleep(7)
msg = "To learn to type quickly, practice often and adopt the proper technique. Fix your posture, have adequate lighting, position your hands correctly over the keyboard, look at the screen and use all your fingers to hit the keys. At first, concentrate on accuracy over speed. This will help you develop muscle memory and create automatic reflexes. Keep practicing and gradually pick up the pace. You'll see results after just a few weeks! To learn to type quickly, practice often and adopt the proper technique. Fix your posture, have adequate lighting, position your hands correctly over the keyboard, look at the screen and use all your fingers to hit the keys. At first, concentrate on accuracy over speed. This will help you develop muscle memory and create automatic reflexes. Keep practicing and gradually pick up the pace. You'll see results after just a few weeks!"
typing(msg, delay=30e-3)
if __name__ == "__main__":
main()