Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions URLShortener/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This is a python script of URL Shortener.

It shortens the URL using 'Generate Short URL' button.

For that, URL should be entered in the required space.

It's a task which most people use it in day to day lives.
27 changes: 27 additions & 0 deletions URLShortener/URLShortener.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
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()