Create a Python-based Internet Speed Test GUI App: A Guide

Create a Python-based Internet Speed Test GUI App: A Guide


Published at - Sep 30, 2021

Whenever we face an internet issue, the first thing we do is an internet speed test. So I have decided to create a Python app to check ping tests and your download speed. I have used pyspeedtest to use internet speed and Tkinter for GUI interface.

To use those packages in our application, first, we need to install them in our system. :)

pip install pyspeedtest
sudo apt-get install python3-tk

To learn more about pyspeedtest, you can refer to the official documentation here.

Exploring options

Check speed

$ pyspeedtest
Using server: speedtest.serv.pt
Ping: 9 ms
Download speed: 148.17 Mbps
Upload speed: 18.56 Mbps

Testing from a Python script:

>>> import pyspeedtest
>>> st = pyspeedtest.SpeedTest()
>>> st.ping()
9.306252002716064
>>> st.download()
42762976.92544772
>>> st.upload()
19425388.307319913

Creating GUI app

create speed-test.py file and paste the following code

import pyspeedtest
from tkinter import *
def Speed_test():
speedTest = pyspeedtest.SpeedTest(textArea.get())
myping.set(speedTest.ping())
down.set(speedTest.download())
master = Tk()
myping = StringVar()
down = StringVar()
Label(master, text="Enter Website URL to ping").grid(row=0, sticky=W)
Label(master, text="Ping test result in ms:").grid(row=3, sticky=W)
Label(master, text="Download test result in bps:").grid(row=4, sticky=W)
pingResult = Label(master, text="", textvariable=myping, ).grid(row=3, column=1, sticky=W)
downloadResult = Label(master, text="", textvariable=down, ).grid(row=4, column=1, sticky=W)
textArea = Entry(master)
textArea.grid(row=0, column=1)
b = Button(master, text="Cheak", command=Speed_test)
b.grid(row=0, column=2, columnspan=2, rowspan=2, padx=5, pady=5)
mainloop()

Done.

To run the following application, you need to run python3 speed-test.py. If python3 is not installed in your system, you need to install Python first. After running python3 speed-test.py, it will launch a GUI interface for the speed test.

Now you can enter server addresses such as www.google.com or www.youtube.com t and hit the check button to start testing your internet speed. It will show you ping speed in ms (milliseconds) and your download speed in bps (bits per second).

So, in this Python app tutorial, we learned about pyspeedtest and Tkinter to create a GUI app. Tkinter is a widely used package to create GUI apps in python if you want to learn more about it in detail please refer to this link.

I hope it will help you to boost your knowledge and if you like this post please clap for it. It will motivate me to write more content. Thank you for reading.





About author

Harendra
Harendra Kanojiya

Hello, I am Harendra Kumar Kanojiya - Owner of this website and a Fullstack web developer. I have expertise in full-stack web development using Angular, PHP, Node JS, Python, Laravel, Codeigniter and, Other web technologies. I also love to write blogs on the latest web technology to keep me and others updated. Thank you for reading the articles.



Related Posts -

Python gui desktop app to download youtube video - python coding
Python gui desktop app to d ...

Hello Guys, Today I am going to create a youtube downloader GUI app to down...



Python program to send mail using gmail smtp - python coding
Python program to send mail ...

In this lesson on python coding, we will learn how to send mail using Gmail...



Follow Us

Follow us on facebook Click Here

Facebook QR
Scan from mobile
Join our telegram channel Click Here
Telegram QR
Scan from mobile