-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
36 lines (22 loc) · 831 Bytes
/
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
from tkinter import *
import pyshorteners
root = Tk()
root.geometry("500x500")
def shorten():
if shorty.get():
shorty.delete(0, END)
if my_entry.get():
url = pyshorteners.Shortener().tinyurl.short(my_entry.get())
shorty.insert(END, url)
print(pyshorteners.Shortener().tinyurl.expand(url))
my_label = Label(root, text="Enter Link To Shorten", font=("Helvetica", 34))
my_label.pack(pady=20)
my_entry = Entry(root, font=("Helvetica", 24))
my_entry.pack(pady=20)
my_button = Button(root, text="Shorten Link", command=shorten, font=("Helvetica", 24))
my_button.pack(pady=20)
shorty_label = Label(root, text="Shortened Link", font=("Helvetica", 14))
shorty_label.pack(pady=50)
shorty = Entry(root, font=("Helvetica", 22), justify=CENTER, width=30, bd=0, bg="systembuttonface")
shorty.pack(pady=10)
root.mainloop()