Skip to content

Commit 92833a7

Browse files
authored
Merge pull request #272 from lovishprabhakar02/main
Create Typing_speed_test.py
2 parents 0e4a28a + a45e3c6 commit 92833a7

File tree

4 files changed

+94
-0
lines changed

4 files changed

+94
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,7 @@ Once you are done working on your script edit this `README.md` file and add the
7777
51| Password Manager | AES encrypted password manager to keep all your password safe | [Find me here](https://github.com/GDSC-RCCIIT/General-Purpose-Scripts/tree/main/scripts/Password_Manager) |
7878
52| Battery Alert | Notifies after threshold unit of battery change | [Find me here](https://github.com/GDSC-RCCIIT/General-Purpose-Scripts/tree/main/scripts/Battery-Notifier) |
7979
53| Text To Handwriting Converter | Converts a text or a text file to handwritten images | [Find me here](https://github.com/GDSC-RCCIIT/General-Purpose-Scripts/tree/main/scripts/text_to_handwriting_converter) |
80+
54| Typing Speed Tester | Calculates the typing speed of users. | [Find me here](https://github.com/lovishprabhakar02/General-Purpose-Scripts/tree/main/scripts/typing_speed_test) |
81+
82+
8083
### Good Luck and don't forget to have fun with Open Source 🚀
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To take the typing speed test,follow these steps:
2+
3+
1. Clone the repository with `https://github.com/GDSC-RCCIIT/General-Purpose-Scripts.git`.
4+
2. Change your working directory to the directory of this script using: `cd General-Purpose-Scripts/scripts/typing_speed_test`.
5+
3. Install the dependencies using `pip install -r requirements.txt`.
6+
4. Run the typing_speed_test.py file in terminal with `python3 typing_speed_test.py`
7+
5. A dialog box will appear, click on go.
8+
6. You're all set to see how much time you take in typing various words! Just type the word and click on done. The time taken will be shown as output
9+
7. If you want to try different words, you can run the program as many times as you want.
10+
11+
12+
Have fun typing!
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tkintertable==1.3.3
2+
pytest-timeit==0.3.0
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# importing all libraries
2+
from tkinter import *
3+
from timeit import default_timer as timer
4+
import random
5+
6+
# creating window using gui
7+
window = Tk()
8+
9+
# the size of the window is defined
10+
window.geometry("450x200")
11+
12+
x = 0
13+
14+
# defining the function for the test
15+
def game():
16+
global x
17+
18+
# loop for destroying the window
19+
# after on test
20+
if x == 0:
21+
window.destroy()
22+
x = x + 1
23+
24+
# defining function for results of test
25+
def check_result():
26+
if entry.get() == words[word]:
27+
28+
# here start time is when the window
29+
# is opened and end time is when
30+
# window is destroyed
31+
end = timer()
32+
33+
# we deduct the start time from end
34+
# time and calculate results using
35+
# timeit function
36+
print(end - start)
37+
else:
38+
print("Wrong Input")
39+
40+
words = ["programming", "coding", "algorithm", "systems", "python", "software"]
41+
42+
# Give random words for testing the speed of user
43+
word = random.randint(0, (len(words) - 1))
44+
45+
# start timer using timeit function
46+
start = timer()
47+
windows = Tk()
48+
windows.geometry("450x200")
49+
50+
# use label method of tkinter for labeling in window
51+
x2 = Label(windows, text=words[word], font="times 20")
52+
53+
# place of labeling in window
54+
x2.place(x=150, y=10)
55+
x3 = Label(windows, text="Start Typing", font="times 20")
56+
x3.place(x=10, y=50)
57+
58+
entry = Entry(windows)
59+
entry.place(x=280, y=55)
60+
61+
# buttons to submit output and check results
62+
b2 = Button(windows, text="Done", command=check_result, width=12, bg="grey")
63+
b2.place(x=150, y=100)
64+
65+
b3 = Button(windows, text="Try Again", command=game, width=12, bg="grey")
66+
b3.place(x=250, y=100)
67+
windows.mainloop()
68+
69+
70+
x1 = Label(window, text="Lets start playing..", font="times 20")
71+
x1.place(x=10, y=50)
72+
73+
b1 = Button(window, text="Go", command=game, width=12, bg="grey")
74+
b1.place(x=150, y=100)
75+
76+
# calling window
77+
window.mainloop()

0 commit comments

Comments
 (0)