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 8b5c987

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in efe3604 according to the output from Autopep8. Details: None
1 parent 3f7b716 commit 8b5c987

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

‎File Sorter GUI/app.py‎

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,49 @@
33
import tkinter as tk
44
from tkinter import filedialog
55

6+
67
class file_sorter:
78
def __init__(self, root):
89
self.root = root
910
self.root.title("File Sorter")
1011
self.root.configure(bg="#333")
11-
12-
self.select_button = tk.Button(root, text="Select Directory", command=self.select_directory, bg="#555", fg="white")
12+
13+
self.select_button = tk.Button(
14+
root, text="Select Directory", command=self.select_directory, bg="#555", fg="white")
1315
self.select_button.pack(pady=10)
14-
15-
self.sort_button = tk.Button(root, text="Sort Files", command=self.sort_files, bg="#555", fg="white")
16+
17+
self.sort_button = tk.Button(
18+
root, text="Sort Files", command=self.sort_files, bg="#555", fg="white")
1619
self.sort_button.pack(pady=5)
17-
20+
1821
self.status_label = tk.Label(root, text="", bg="#333", fg="white")
1922
self.status_label.pack(pady=10)
20-
23+
2124
def select_directory(self):
2225
self.dir_path = filedialog.askdirectory()
2326
self.status_label.config(text="Selected directory: " + self.dir_path)
24-
27+
2528
def sort_files(self):
2629
if hasattr(self, "dir_path"):
2730
for filename in os.listdir(self.dir_path):
2831
if os.path.isfile(os.path.join(self.dir_path, filename)):
2932
ext = filename.split(".")[-1]
3033
target_dir = os.path.join(self.dir_path, ext)
31-
34+
3235
if not os.path.exists(target_dir):
3336
os.makedirs(target_dir)
34-
37+
3538
source_path = os.path.join(self.dir_path, filename)
3639
target_path = os.path.join(target_dir, filename)
37-
40+
3841
shutil.move(source_path, target_path)
39-
42+
4043
self.status_label.config(text="Files sorted successfully.")
4144
else:
4245
self.status_label.config(text="Please select a directory first.")
4346

47+
4448
if __name__ == "__main__":
4549
root = tk.Tk()
4650
app = file_sorter(root)
4751
root.mainloop()
48-

0 commit comments

Comments
(0)

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