Are you looking for an easy way to capture screenshots using Python? π In this step-by-step guide, we'll create a screenshot tool in Python β starting from a basic command-line method and then building a fully-featured GUI screenshot application using Tkinter and Pillow.
This tutorial is perfect for beginners and intermediate developers looking to enhance their Python skills with real-world projects.

πΈ Basic Screenshot Tool (CMD Version)
If you're just starting, the simplest way to take a screenshot in Python is with the pyautogui library.
Step 1: Install pyautogui
Step 2: Write the script
β
That's it! Run this script and it captures your current screen, saving it as screenshot.png in your working directory.
π₯οΈ Building a Full GUI Screenshot Tool
Now let's step it up and create a graphical screenshot application using Tkinter, Pillow, and ImageGrab. This tool lets users capture the full screen, select a specific area, edit the screenshot (draw annotations), and save the final result.
Step 1: Install required libraries
(Tkinter usually comes pre-installed with Python.)
Step 2: The complete GUI code
π¨ Features of Our Screenshot Application
- Modern UI: styled with custom colors, fonts, and a window icon.
- Full-screen capture: instantly grab the entire screen.
- Area selection: drag to capture only a specific part of the screen.
- Edit screenshot: annotate with freehand drawing and a color picker.
-
Save to file: save the edited or original screenshot as a
.png.
π How to Add an App Icon
To make the window even more polished, add a custom icon.ico:
- Download free icons from IconArchive or Favicon.io.
-
Place the
icon.icoin the same folder as your script.
-
The line
self.root.iconbitmap('icon.ico')sets the window icon.
π Final Thoughts
Congratulations! You've built not one but two Python screenshot tools β a simple one for quick use and a GUI application ready for daily professional use. Along the way you've practiced Python GUI frameworks, image processing with Pillow, UX design (custom colors, fonts, icons), and interactive features like freehand drawing.
Want to go further? Add hotkeys to capture without opening the app, integrate cloud upload (Google Drive, Dropbox), or add screen recording and GIF creation. Stay tuned for more! π
About the Author: Minu Das
Data Scientist & Python Instructor
Minu is a data scientist with a background in applied machine learning. She writes Geeky Script's Python and AI/ML tutorials, focusing on the fundamentals that trip up beginners most β data handling, NumPy/Pandas workflows, and the math behind the models.