-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
59 lines (41 loc) · 1.59 KB
/
main.py
File metadata and controls
59 lines (41 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from tkinter import StringVar, Tk, Label, Button, Frame, PhotoImage
from backend import cleaner
from tkinter import filedialog
root = Tk()
root.title("Desktop Cleaner")
root.config(bg="skyblue")
root.minsize(400, 400) # width, height
left_frame = Frame(root, width=400, height=400)
left_frame.grid(row=0, column=0, padx=10, pady=5)
path = StringVar()
status_text = StringVar(value="Select a folder to clean.")
def browse_button():
filename = filedialog.askdirectory()
if filename:
path.set(filename)
status_text.set("Folder selected. Ready to clean.")
def run_cleaner():
selected_path = path.get()
if not selected_path:
status_text.set("Please select a folder first.")
return
cleaner(selected_path)
status_text.set("Process completed.")
left_frame = Frame(root, width=200, height=400, bg="skyblue")
left_frame.grid(row=0, column=0, padx=10, pady=5)
Label(left_frame, text="Select A folder to clean").grid(row=0, column=0, padx=5, pady=5)
image = PhotoImage(file="file_organizer_logo.png")
original_image = image.subsample(3, 3)
Label(left_frame, image=original_image).grid(row=1, column=0, padx=5, pady=5)
tool_bar = Frame(left_frame, width=180, height=185, bg="skyblue")
tool_bar.grid(row=2, column=0, padx=5, pady=5)
Button(tool_bar, text="Browse", command=browse_button).grid(
row=0, column=0, padx=5, pady=3, ipadx=10
)
Button(tool_bar, text="Clean", command=run_cleaner).grid(
row=1, column=0, padx=5, pady=3, ipadx=10
)
Label(left_frame, textvariable=status_text, bg="skyblue").grid(
row=3, column=0, padx=5, pady=10
)
root.mainloop()