π₯ Build a Modern Internet Speed Test App in Python – GUI Speedtest with Loading Animation π
Demo :
Click Video πππ
Learn how to create a modern and stylish Internet Speed Test App in Python using CustomTkinter & Speedtest. This GUI-based tool features a smooth loading animation while checking download, upload, and ping speeds. Perfect for beginners and advanced Python enthusiasts!
Code :
Save logo path (assets/speed_logo.png) :
import speedtest
import customtkinter as ctk
from PIL import Image
import threading
# CustomTkinter Theme
ctk.set_appearance_mode("dark")
ctk.set_default_color_theme("blue")
# Function to Test Speed with Loading
def check_speed():
loading_label.configure(text="Testing... Please wait", text_color="yellow")
test_button.configure(state="disabled")
def run_speedtest():
st = speedtest.Speedtest()
st.get_best_server()
download_speed = round(st.download() / 1_000_000, 2) # Convert to Mbps
upload_speed = round(st.upload() / 1_000_000, 2) # Convert to Mbps
ping_speed = st.results.ping # Ping in ms
download_label.configure(text=f"Download: {download_speed} Mbps")
upload_label.configure(text=f"Upload: {upload_speed} Mbps")
ping_label.configure(text=f"Ping: {ping_speed} ms")
loading_label.configure(text="Test Completed!", text_color="green")
test_button.configure(state="normal")
thread = threading.Thread(target=run_speedtest)
thread.start()
# GUI Setup
app = ctk.CTk()
app.geometry("400x500")
app.title("Internet Speed Test - FuzzuTech")
# Load Logo Image
logo = ctk.CTkImage(light_image=Image.open("assets/speed_logo.png"), size=(80, 80))
logo_label = ctk.CTkLabel(app, image=logo, text="")
logo_label.pack(pady=10)
# Title
title_label = ctk.CTkLabel(app, text="Internet Speed Test", font=("Arial", 20, "bold"))
title_label.pack()
# Loading Label
loading_label = ctk.CTkLabel(app, text="", font=("Arial", 14, "italic"))
loading_label.pack(pady=5)
# Results Labels
download_label = ctk.CTkLabel(app, text="Download: - Mbps", font=("Arial", 16))
download_label.pack(pady=5)
upload_label = ctk.CTkLabel(app, text="Upload: - Mbps", font=("Arial", 16))
upload_label.pack(pady=5)
ping_label = ctk.CTkLabel(app, text="Ping: - ms", font=("Arial", 16))
ping_label.pack(pady=5)
# Test Button
test_button = ctk.CTkButton(app, text="Test Speed", command=check_speed, font=("Arial", 16))
test_button.pack(pady=20)
# Footer
footer_label = ctk.CTkLabel(app, text="Developed by FuzzuTech", font=("Arial", 12, "italic"))
footer_label.pack(pady=10)
app.mainloop()
Comments
Post a Comment