The Typing Speed Test In Python is a test that measures the number of words and characters you can type per minute.
In addition, speed typing tests also measure spelling accuracy.
Project Output:
How Does This Project Test Your Typing Speed?
In this Best Speed Typing Test, the number of words you can correctly type in a given amount of time is used to determine your typing speed.
A word is composed of five keystrokes. Both speed and accuracy are measured during a test.
You’ll be given a figure that represents your average words per minute (WPM) as well as a percentage that represents your accuracy.
Why We Need To Have a Typing Speed Test?
The Speed Typing Test Python Project will determine your accuracy, as well as whether you need to work on anything.
The average typing speed is 40 words per minute (WPM).
Try to go above and beyond! You can take the test multiple times to see how your typing speed progresses.
Why Speed Is Important In Typing?
It assists you in completing your work more quickly and efficiently, becoming more familiar with the computer, and communicating with coworkers and superiors via text file.
Typing is still a basic skill, yet it’s one of the most crucial computer abilities you can master.
Learning to type quickly and properly will benefit you in a variety of situations, and it should be regarded as a necessary ability for anyone who plans to work with a computer in any capacity (which is almost everyone!).
Benefits Of Learning How To Type Fast and Accurately
- More Opportunities – Finally, because touch-typing is such a beneficial skill for increasing workplace productivity, it can assist you in finding more and better career prospects.
- Improve your ability to concentrate – Another advantage of learning to type faster is that you won’t have to look at the keyboard or consider where your fingers will go. Once you are typing fast, you will be able to gaze directly at the screen, and your fingers will type without you even thinking about the movements
Project Details and Technology
Project Name: | Typing Speed Test In Python |
Abstract: | This Typing Speed Test in Python is a simple project for all users who want to improve their typing skills. |
Language/s Used: | Python (GUI Based) |
Python version (Recommended): | 3.8 or 3.9 |
Type: | Desktop Application |
Developer: | Source Code Hero |
Updates: | 0 |
About the Project
In this project idea, we’ll create an amazing project that will allow you to test and improve your typing speed.
We’ll use the Pygame library, which is used to work with graphics, to create a graphical user interface.
The images and text that will be displayed on the screen will be drawn.
Additionally, the Typing Speed Test Using Python is a simple desktop application made using the Python programming language.
We may also create highly fascinating games with the Python programming language.
How To Make A Typing Speed Test?
The code given below is the full source code for creating a typing speed test.
The given code below is a Python file for main.py
import pygame from pygame.locals import * import sys import time import random # 750 x 500 class Game: def __init__(self): self.w=750 self.h=500 self.reset=True self.active = False self.input_text='' self.word = '' self.time_start = 0 self.total_time = 0 self.accuracy = '0%' self.results = 'Time:0 Accuracy:0 % Wpm:0 ' self.wpm = 0 self.end = False self.HEAD_C = (255,213,102) self.TEXT_C = (240,240,240) self.RESULT_C = (255,70,70) pygame.init() self.open_img = pygame.image.load('type-speed-open.png') self.open_img = pygame.transform.scale(self.open_img, (self.w,self.h)) self.bg = pygame.image.load('background.jpg') self.bg = pygame.transform.scale(self.bg, (500,750)) self.screen = pygame.display.set_mode((self.w,self.h)) pygame.display.set_caption('Type Speed test') def draw_text(self, screen, msg, y ,fsize, color): font = pygame.font.Font(None, fsize) text = font.render(msg, 1,color) text_rect = text.get_rect(center=(self.w/2, y)) screen.blit(text, text_rect) pygame.display.update() def get_sentence(self): f = open('sentences.txt').read() sentences = f.split('\n') sentence = random.choice(sentences) return sentence def show_results(self, screen): if(not self.end): #Calculate time self.total_time = time.time() - self.time_start #Calculate accuracy count = 0 for i,c in enumerate(self.word): try: if self.input_text[i] == c: count += 1 except: pass self.accuracy = count/len(self.word)*100 #Calculate words per minute self.wpm = len(self.input_text)*60/(5*self.total_time) self.end = True print(self.total_time) self.results = 'Time:'+str(round(self.total_time)) +" secs Accuracy:"+ str(round(self.accuracy)) + "%" + ' Wpm: ' + str(round(self.wpm)) # draw icon image self.time_img = pygame.image.load('icon.png') self.time_img = pygame.transform.scale(self.time_img, (150,150)) #screen.blit(self.time_img, (80,320)) screen.blit(self.time_img, (self.w/2-75,self.h-140)) self.draw_text(screen,"Reset", self.h - 70, 26, (100,100,100)) print(self.results) pygame.display.update() def run(self): self.reset_game() self.running=True while(self.running): clock = pygame.time.Clock() self.screen.fill((0,0,0), (50,250,650,50)) pygame.draw.rect(self.screen,self.HEAD_C, (50,250,650,50), 2) # update the text of user input self.draw_text(self.screen, self.input_text, 274, 26,(250,250,250)) pygame.display.update() for event in pygame.event.get(): if event.type == QUIT: self.running = False sys.exit() elif event.type == pygame.MOUSEBUTTONUP: x,y = pygame.mouse.get_pos() # position of input box if(x>=50 and x<=650 and y>=250 and y<=300): self.active = True self.input_text = '' self.time_start = time.time() # position of reset box if(x>=310 and x<=510 and y>=390 and self.end): self.reset_game() x,y = pygame.mouse.get_pos() elif event.type == pygame.KEYDOWN: if self.active and not self.end: if event.key == pygame.K_RETURN: print(self.input_text) self.show_results(self.screen) print(self.results) self.draw_text(self.screen, self.results,350, 28, self.RESULT_C) self.end = True elif event.key == pygame.K_BACKSPACE: self.input_text = self.input_text[:-1] else: try: self.input_text += event.unicode except: pass pygame.display.update() clock.tick(60) def reset_game(self): self.screen.blit(self.open_img, (0,0)) pygame.display.update() time.sleep(1) self.reset=False self.end = False self.input_text='' self.word = '' self.time_start = 0 self.total_time = 0 self.wpm = 0 # Get random sentence self.word = self.get_sentence() if (not self.word): self.reset_game() #drawing heading self.screen.fill((0,0,0)) self.screen.blit(self.bg,(0,0)) msg = "Typing Speed Test" self.draw_text(self.screen, msg,80, 80,self.HEAD_C) # draw the rectangle for input box pygame.draw.rect(self.screen,(255,192,25), (50,250,650,50), 2) # draw the sentence string self.draw_text(self.screen, self.word,200, 28,self.TEXT_C) pygame.display.update() Game().run()
Steps On How To Run The Project
Time needed: 5 minutes
These are the steps on how to run a Typing Speed Test In Python with Source Code
- Download Source Code
First, find the downloadable source code below and click to start downloading the source code file.
- Extract File
Next, after finished to download the file, go to the file location and right click the file and click extract.
- Open PyCharm
Next, open pycharm IDE and open the project you’ve download.
- Run Project
Next, go to the Pycharm and click the run button to start executing the project.
Download the Source Code below!
Summary
This article is a way to enhance and develop our skills and logic ideas which is important in practicing the Python programming language which is the most well-known and most usable programming language in many companies.
Inquiries
If you have any questions or suggestions about the Typing Speed Test, please feel free to leave a comment below.