TechieYan Technologies

Typing Speed Test with Tkinter in python

Abstract

On this typing speed test using python, we are going to construct an exciting venture through which you could check or even enhance your typing pace. For a graphical person interface, we’re going to use the Tkinter which is used for working with simple graphics.

Libraries:

  • Tkinter: This module is for creating an easy and simple GUI in Python. To install the module Tkinter, use the following command:

pip install tk

  • Difflib:This module presents classes and capabilities for evaluating sequences. It could be used for instance, for evaluating files, and can produce data about record differences in diverse codecs, including HTML and context and unified diffs. . To install the module difflib, use the following command:

pip install difflib

Typing Speed Test In Python

Code Description & Execution

Program Methodology

As written above we need to import the libraries in the program root is defined and made an instance of tk().Now that we have created a window, we can be specifying some attributes to it. To give a selected size to the window, we use the geometry() technique. We give a name to the window the use of the name() approach. Now we want to feature a heading to our window. For this we create a label named head the use of the Label() method. Whilst the use of a Label() method, we can specify the textual content, font, historical past color, foreground shade, and so on. To show this Label on the window, we use the percent() method.

The sentences are decided on randomly from the list ‘phrases’ and displayed on the screen. Along with randomly picking the sentences, we are initializing the start variable with default_timer().

In this program we are the use of the default_timer feature from the timeit module to calculate the time taken and then we are the use of a round characteristic to round it to 2 decimal locations.

We are calculating the rate the usage of the method (len(phrase) / time taken). It then checks the entered string with the modern string and if each the strings do now not fit, it shows the time taken to type the given string, accuracy, and velocity. To calculate accuracy we’re using difflib’s SequenceMatcher characteristic.

It asks the person to enter the given string the use of entry and Label widgets of Tkinter. And after that, it calls the test feature to display the result.

How to Execute?

Note: Make sure you have added path while installing the software’s.

http://techieyantechnologies.com/2022/07/how-to-install-anaconda/

http://techieyantechnologies.com/2022/06/get-started-with-creating-new-environment-in-anaconda-configuring-jupyter-notebook-and-installing-libraries-using-requirements-txt-2/

  1. Install the prerequisites/software’s required to execute the code from reading the above blog which is provided in the link above.
  2. Press windows key and type in anaconda prompt a terminal opens up.
  3. Go to the directory where your requirement.txt file is present, not just requirement.txt, if you want to execute any .py or .ipynb files, you need to go to that specific folder or path, where they are saved.
  4. <<directory of your file:>>. E.g., If my file is in d drive, then.
  5. Type d:
  1. cd d:\License-Plate-Recognition-main    #CHANGE PATH AS PER YOUR PROJECT, THIS IS JUST AN EXAMPLE

          7. If your project is in c drive, you can ignore step 4 and go with step 5

          8. Run pip install -r requirements.txt or conda install requirements.txt (Requirements.txt is a text file consisting of all the necessary libraries required for executing this python file. If it gives any error while installing libraries, you might need to install them individually.), example: pip install “module_name”.

Results

Typing Speed Test In Python

Issues Faced

  1. We might face an issue while installing specific libraries, in this case, you might need to install the libraires manually. Example: pip install “module_name/library” i.e., pip install pandas
  2. Make sure you have the latest or specific version of python, since sometimes it might cause version mismatch.

Click Here To Download This Code And Associated File.

 

Conclusion

We have implemented the python typing speed test successfully. GUI application development in python is fun. Tkinter provides most of the functionalities as pre-built. We hope now you have a clear understanding of random(), default_timer() functions, and Tkinter.

+91 7075575787