A modern, dark-themed desktop application built in Python using Tkinter and Pillow (PIL) to locate and safely remove duplicate files. This repository also serves as a playground for learning Python fundamentals, including file handling, cryptography hashing, and Tkinter GUI development.
The primary application (duplicate_finder.py or learn_tkinter.py) is a GUI tool that scans directories and detects duplicate files based on their actual content (MD5 hashes), rather than just file names.
- MD5 Content Hashing: Uses MD5 verification. Even if two files have different names, they will be flagged as duplicates if their content is identical.
- Finder-like Interface: Uses a
ttk.Treeviewlayout showing File Name, Size, Type, Path, and Status. - Color-Coded Grouping: Automatically groups duplicate sets with distinct, harmonic colors to make them easy to differentiate.
- Safe Deletion: Supports multiple selections and prompts the user with confirmation dialogs to prevent accidental file deletion.
- Responsive Dark Theme: Styled with a premium dark palette (
#232f3eAmazon Dark Blue) to be easy on the eyes.
Ensure you have Python 3 installed. You will also need to install the Pillow library for image handling:
pip install PillowRun the main script from your terminal:
python3 duplicate_finder.py| File | Description |
|---|---|
duplicate_finder.py |
The main duplicate finder utility with full Treeview features. |
learn_tkinter.py |
An experimental canvas used to study Tkinter widgets (Labels, Entries, Buttons, positioning). |
file_handling.py |
Helper script exploring directory traversal (os.chdir, os.getcwd) and string/byte hashing. |
Sets.py |
Small script practicing Python Set operations. |
To identify duplicates efficiently without loading entire files into memory at once, the app reads files in binary chunks (8192 bytes) and updates an MD5 hasher:
def get_file_md5(filepath):
hasher = hashlib.md5()
with open(filepath, 'rb') as f:
while True:
chunk = f.read(8192)
if not chunk:
break
hasher.update(chunk)
return hasher.hexdigest()Understanding the layout capabilities of Tkinter using:
.pack(): Stacking elements and handling margins (padx,pady)..grid(): Creating structured row/column alignment..place(): Positioning elements using exact or relative coordinates (x,y,relx,rely).
ttk: Used to implement the native-themed widgets likeTreeview(tables).filedialog: Invokes the OS's native folder and file selection dialogs.messagebox: Delivers warnings, errors, and confirmation popups (yes/no).