Typing Speed test 2

Tkinter Projects in Tkinter Typing Speed Test 1

Typing speed test using random string

Tkinter demo to use countdown timer to check typing speed of user by using threading

  1. Rondom string is generated and presented to the user
  2. User enters the given string in a Text widget.
  3. If the user entered string matches with the given string then a new string is given after removing the old one. User is allowed to enter fresh string.
  4. Before adding data user has to click one Start button. This button will enable the data entry and the entery widget will be disabled once time is over.
  5. One countdown timer will show the remaining time
  6. Total number of chars entered in text widget will be displayed once the time period is over.
Allowed to enter any text to check your speed: Part 1
import tkinter  as tk 
from tkinter import BOTH, END, LEFT
import time
import threading
import random
import string
my_w = tk.Tk()
global Nos
duration=20 # time duration of test in seconds 
word_size=4 # size of the random string generated
def my_start(): # start button is clicked
    global Nos
    l2['text']='' # remove previous data
    t1.config(state='normal') # enable to enter text
    t1.delete('1.0',END) # remove entered text at starting
    for i in range(duration,-1,-1): # change the duration of test
        l1['text']=i # showing the time left
        time.sleep(1)# one second delay  
    t1.config(state='disabled')  # time over so disable     
    Nos=0 # Score set to 0 for next test 

#random string generator
def id_generator(size=word_size, chars=string.ascii_lowercase):
    return ''.join(random.choice(chars) for _ in range(size))
global str_ck # to store random string 
str_ck=id_generator() # get random string 
l1=tk.Label(my_w) # count down timmer 
l3.place(relx=0.3,rely=0.1) # show the random string
#   command=lambda:my_start())          
b1.place(relx=0.1,rely=0.1)  # start button 

t1.place(relx=0.1,rely=0.3) # User entry box 

l2.place(relx=0.1,rely=0.5) # displaying score 

def check_str(*args):
    global Nos
    global str_ck
        Nos= Nos + word_size 
        t1.delete('1.0',END) # remove entered text 
        str_ck=id_generator()# one more randome string
        l3['text']=str_ck # show the string
        l2['text']="Completed " + str(Nos) + \
            " in "+ str(duration) + " seconds"

t1.bind("<KeyRelease>",check_str) # User data entry Event handling
my_w.mainloop()  # Keep the window open
Python Tkinter Projects
Tkinter Text Tkinter Entry How to Validate user entered data


* indicates required
Subscribe to plus2net


    Post your comments , suggestion , error , requirements etc here

    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2021 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer