From 8ac356c5e015e14a4c9cb1b8c4b9ddc336d13ee5 Mon Sep 17 00:00:00 2001 From: turtlecode <85156399+turtlecode@users.noreply.github.com> Date: Mon, 2 May 2022 12:23:08 +0300 Subject: [PATCH] How to shorten an URL LINK - Python For Beginners How to shorten an URL LINK - Python For Beginners --- .idea/.gitignore | 3 ++ .idea/.name | 1 + .idea/inspectionProfiles/Project_Default.xml | 22 ++++++++++++ .../inspectionProfiles/profiles_settings.xml | 6 ++++ .idea/misc.xml | 4 +++ .idea/modules.xml | 8 +++++ .idea/python____project.iml | 8 +++++ main.py | 36 +++++++++++++++++++ 8 files changed, 88 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/.name create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/python____project.iml create mode 100644 main.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..11a5d8e --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +main.py \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..d8c8b2b --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,22 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..8978022 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..2205757 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/python____project.iml b/.idea/python____project.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/python____project.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..cbb99d1 --- /dev/null +++ b/main.py @@ -0,0 +1,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() \ No newline at end of file