Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 30bad6f

Browse files
Merge pull request avinashkranjan#2820 from avinashkranjan/deepsource-transform-76c5843a
format code with autopep8
2 parents da6c831 + 1b2fa6a commit 30bad6f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

‎Image Downloader GUI/main.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
import os
44
import requests
55

6+
67
def get_ext(url: str) -> str | None:
78
exts = [".png", ".jpeg", ".jpg"]
89
for ext in exts:
910
if ext in url:
1011
return ext
1112
return None
1213

14+
1315
def download_img():
1416
u = url_ent.get()
1517
n = name_ent.get()
@@ -27,7 +29,8 @@ def download_img():
2729
img_path = os.path.join(f, f"{n}{ext}")
2830

2931
if os.path.isfile(img_path):
30-
messagebox.showerror("Error", "A file with the same name already exists.")
32+
messagebox.showerror(
33+
"Error", "A file with the same name already exists.")
3134
return
3235

3336
try:
@@ -38,6 +41,7 @@ def download_img():
3841
except Exception as e:
3942
messagebox.showerror("Error", f"An error occurred: {e}")
4043

44+
4145
root = tk.Tk()
4246
root.title("Image Downloader")
4347
root.configure(bg="#1e1e1e")
@@ -60,7 +64,8 @@ def download_img():
6064
folder_ent = tk.Entry(root, width=50)
6165
folder_ent.pack(pady=5)
6266

63-
dl_btn = tk.Button(root, text="Download", command=download_img, bg="#303030", fg="white")
67+
dl_btn = tk.Button(root, text="Download",
68+
command=download_img, bg="#303030", fg="white")
6469
dl_btn.pack(pady=10)
6570

6671
root.mainloop()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /