tldrforlink.py 737 B

123456789101112131415161718192021222324252627
  1. from tkinter import *
  2. import pyshorteners
  3. import pyperclip
  4. root = Tk()
  5. root.title("urlshortner")
  6. root.configure(bg = "green")
  7. url = StringVar()
  8. sortUrl = StringVar()
  9. def urlshort():
  10. sort_Url = url.get()
  11. generatedurl = pyshorteners.Shortener().tinyurl.short(sort_Url)
  12. sortUrl.set(generatedurl)
  13. def copy():
  14. generatedurl = sortUrl.get()
  15. pyperclip.copy(generatedurl)
  16. Label(root, text = "Urlshortnerapp", font = "Arial").pack(pady = 10)
  17. Entry(root, textvariable = url).pack(pady = 5)
  18. Button(root, text = "generateurl", command = urlshort).pack(pady = 5)
  19. Entry(root, textvariable = sortUrl).pack(pady = 5)
  20. Button(root, text = "copyurl", command = copy).pack(pady = 5)
  21. root.mainloop()