-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathurl_shortener.py
52 lines (27 loc) · 1.45 KB
/
url_shortener.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
41
42
43
44
45
46
47
48
49
50
51
52
# URL Shortener Project using Python Language
import tkinter
import pyshorteners
def shorten():
shortener = pyshorteners.Shortener()
text = input1_url.get()
short_url = shortener.tinyurl.short(text)
input2_shortened_url.insert(0 , short_url)
rootWindow = tkinter.Tk() # Parent Window
rootWindow.title("URL Shortener Project")
rootWindow.geometry("1200x700")
rootWindow.configure(bg='#333333')
frame = tkinter.Frame(bg='#333333')
msg = tkinter.Label(frame , text = "URL Shortener using Python" , fg='#FF3399' , bg='#333333' , font = ('Arial',25))
msg.grid(row = 0 , column = 0 , columnspan = 2 , sticky = 'news' , pady = 40)
label1_message = tkinter.Label(frame , text = "Paste URL" , fg='white' , bg='#333333' , font = ('Arial',15))
label1_message.grid(row = 1 , column = 0)
input1_url = tkinter.Entry(frame , width = 100 , font = ('Arial',15))
input1_url.grid(row = 1 , column = 1 , pady = 20)
label2_message = tkinter.Label(frame , text = "Shortened URL" , fg='white' , bg='#333333' , font = ('Arial',15))
label2_message.grid(row = 2 , column = 0)
input2_shortened_url = tkinter.Entry(frame , width = 100 , font = ('Arial',15))
input2_shortened_url.grid(row = 2 , column = 1 , pady = 20)
shortener_button = tkinter.Button(frame , text = "Shorten URL" , command=shorten , fg='white' , bg='#FF3399' , font = ('Arial',15))
shortener_button.grid(row = 3 , column = 0 , columnspan=2 , pady = 30)
frame.pack()
rootWindow.mainloop()