From b2e1c9c74eacfa7ad0d35a0a9cebac40bee3482c Mon Sep 17 00:00:00 2001 From: Prathima Kadari Date: Thu, 13 May 2021 14:56:41 +0530 Subject: [PATCH] Added URL Shortener.py --- Python/URL Shortener.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Python/URL Shortener.py diff --git a/Python/URL Shortener.py b/Python/URL Shortener.py new file mode 100644 index 00000000..f1d754cf --- /dev/null +++ b/Python/URL Shortener.py @@ -0,0 +1,26 @@ +import pyperclip +import pyshorteners +from tkinter import* + +root=Tk() +root.geometry("400x200") +root.title("URL Shortener") +root.configure(bg="#49A") +url=StringVar() +url_address=StringVar() + +def urlshortner(): + urladdress=url.get() + url_short=pyshorteners.Shortener().tinyurl.short(urladdress) + url_address.set(url_short) + +def copyurl(): + url_short=url_address.get() + pyperclip.copy(url_short) +Label(root,text="My URL Shortener", font="poppins").pack(pady=10) +Entry(root, textvariable=url).pack(pady=5) +Button(root, text="Generate Short URl", command=urlshortner).pack(pady=7) +Entry(root, textvariable=url_address).pack(pady=5) +Button(root, text="Copy URL", command=copyurl).pack(pady=5) + +root.mainloop()