-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpeedTest.py
40 lines (30 loc) · 975 Bytes
/
SpeedTest.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
40
from tkinter import*
import speedtest
st=speedtest.Speedtest()
def click(event):
global scvalue
text=event.widget.cget("text")
print(text)
if text=="DownLoad":
x=float(st.download())
download_mbs = round(x / (10 ** 6), 2)
scvalue.set(download_mbs)
screen.update()
if text=="UpLoad":
x=float(st.upload())
upload_mbs = round(x / (10 ** 6), 2)
scvalue.set(upload_mbs)
screen.update()
root =Tk()
root.geometry("300x200")
scvalue=StringVar()
scvalue.set("")
screen=Entry(root,textvar=scvalue,width=60,font='lucide 28')
screen.pack(fill=X,padx=10,pady=10)
b=Button(text='UpLoad',fg='black',padx=10,pady=10,font="algerian 10 bold")
b.pack(side=LEFT,padx=10,pady=10)
b.bind("<Button-1>",click)
b=Button(text='DownLoad',fg='black',padx=10,pady=10,font="algerian 10 bold")
b.pack(side=RIGHT,padx=10,pady=10)
b.bind("<Button-1>",click)
root.mainloop()