Skip to content

Commit

Permalink
Merge pull request csubhasundar#214 from IshitaPathak/main
Browse files Browse the repository at this point in the history
url_shortener
  • Loading branch information
sherigar authored Oct 23, 2023
2 parents 5105f44 + e1356cc commit 829ff77
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions python/url_shortener.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import tkinter as tk
import pyshorteners

def shorten():
#creating instance of shortner class
shortener=pyshorteners.Shortener()
short_url=shortener.tinyurl.short(longurl_entry.get())
print(shorturl_entry.insert(0,short_url))

# creating root window
root = tk.Tk()
root.title("URL Shortener")
root.geometry("300x150")


longurl_label=tk.Label(root,text="Enter URL")
longurl_entry=tk.Entry(root)
shorturl_label=tk.Label(root,text="Shortened URL")
shorturl_entry=tk.Entry(root)
shorten_button=tk.Button(root,text="Shorten URL", command=shorten)

longurl_label.pack()
longurl_entry.pack()
shorturl_label.pack()
shorturl_entry.pack()
shorten_button.pack()
root.mainloop()

0 comments on commit 829ff77

Please sign in to comment.