-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
29 lines (22 loc) · 695 Bytes
/
Copy pathmain.py
File metadata and controls
29 lines (22 loc) · 695 Bytes
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
import tkinter
import pyshorteners
root = tkinter.Tk()
root.title("URL Shortener")
root.geometry("500x250")
url = input('Enter the URL: ')
def func(url):
shortedURL = pyshorteners.Shortener()
entry2.insert(0, shortedURL.tinyurl.short(url))
# print(entry2.insert(0, shortedURL.tinyurl.short(url)))
# func(url)
label1 = tkinter.Label(root, text="Enter the URL to be shortened")
entry1 = tkinter.Entry(root)
label2 = tkinter.Label(root, text="Shortened URL")
entry2 = tkinter.Entry(root)
button = tkinter.Button(root, text="Shorten URL", command=func(entry1.get()))
label1.pack()
entry1.pack()
label2.pack()
entry2.pack()
button.pack()
root.mainloop()