-
Notifications
You must be signed in to change notification settings - Fork 185
/
Copy pathmain.py
39 lines (29 loc) · 1.21 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from tkinter import *
from speedtest import Speedtest # first do pip unistall speedtest then do pip install
root = Tk()
root.title("Internet Speed Checker")
root.geometry('1920x1080')
root.resizable(True,True)
def get_speed():
speed = Speedtest()
download = speed.download()
upload = speed.upload()
ping = speed.results.ping
download_speed = round(download / 8 / 1024 / 1024,2)
upload_speed = round(upload / 8 / 1024 / 1024,2)
ping = round(ping, 2)
down_lab.config(text='Download Speed : ' + str(download_speed) + " Mbps")
upload_lab.config(text='Upload Speed : ' + str(upload_speed) + " Mbps")
ping_lab.config(text='Ping : ' + str(ping) + " ms")
fg = '#0cc6a9'
bg = '#ed4947'
title = Label(root, text="Internet Spped Tester",fg=fg, font=("Ubuntu",24,"bold"))
test_btn = Button(root, text="Get Speed",font=('Helvetica',32,'bold'),command=get_speed,bg=bg)
test_btn.place(x=800, y=700)
down_lab = Label(root,text='',fg=fg,font=('Ubuntu',24,'bold'))
down_lab.place(x=800, y = 100)
upload_lab = Label(root,text='',fg=fg,font=('Ubuntu',24,'bold'))
upload_lab.place(x=800, y = 300)
ping_lab = Label(root,text='',fg=fg,font=('Ubuntu',24,'bold'))
ping_lab.place(x=800, y = 500)
root.mainloop()