1
+ import tkinter as tk
2
+ import speedtest
3
+ from tkinter import messagebox
4
+
5
+ st = speedtest .Speedtest ()
6
+ root = tk .Tk ()
7
+ root .geometry ("400x400" )
8
+ root .title ("SpeedTest" )
9
+ root .config (bg = "#3b4d61" )
10
+ font = ("Verdana" ,15 , "bold" )
11
+
12
+ def check ():
13
+ messagebox .showinfo ("Confirmation" , '''Speed Test Starting .....
14
+ It may take upto 1 min''' )
15
+ d .configure (text = str (st .download ()// 10 ** 6 )+ "Mbps" )
16
+ u .configure (text = str (st .upload ()// 10 ** 6 )+ "Mbps" )
17
+ p .configure (text = str (int (st .results .ping ))+ "MS" )
18
+ l .configure (text = "Speed Test Complete" )
19
+
20
+ dspeed = tk .Label (root ,text = "Download Speed:" ,bg = "#3b4d61" ,fg = "yellow" ,font = font )
21
+ dspeed .place (x = 10 ,y = 10 )
22
+ d = tk .Label (root ,text = "0 Mbps" ,bg = "#3b4d61" ,fg = "yellow" ,font = font )
23
+ d .place (x = 250 ,y = 10 )
24
+ uspeed = tk .Label (root ,text = "Upload Speed:" ,bg = "#3b4d61" ,fg = "yellow" ,font = font )
25
+ uspeed .place (x = 10 ,y = 50 )
26
+ u = tk .Label (root ,text = "0 Mbps" ,bg = "#3b4d61" ,fg = "yellow" ,font = font )
27
+ u .place (x = 250 ,y = 50 )
28
+ ping = tk .Label (root ,text = "Ping:" ,bg = "#3b4d61" ,fg = "yellow" ,font = font )
29
+ ping .place (x = 10 ,y = 90 )
30
+ p = tk .Label (root ,text = "0 MS" ,bg = "#3b4d61" ,fg = "yellow" ,font = font )
31
+ p .place (x = 250 ,y = 90 )
32
+
33
+ l = tk .Label (root ,text = "Click Here to start speed test" ,bg = "#3b4d61" ,fg = "yellow" ,font = (15 ))
34
+ l .place (x = 50 ,y = 250 )
35
+ b = tk .Button (root ,text = "Speed Text" ,command = check ,bg = "yellow" ,fg = "black" )
36
+ b .place (x = 50 ,y = 300 ,height = 40 ,width = 300 )
37
+ root .mainloop ()
0 commit comments