Python Screenshot Application Using Tkinter and PyAutoGUI Library Full Project For Beginners

You are currently viewing Python Screenshot Application Using Tkinter and PyAutoGUI Library Full Project For Beginners

Welcome folks today in this tutorial we will be building a gui application in python with the help of tkinter and pyautogui library in this application you can take the screenshot of the screen that you are currently viewing on the desktop. The detailed practical video is shown below see the video and understand the concept behind building the application.






Now you can see in the screenshot of the app we have the simple gui window that we have made with the help of Tkinter library in Python and then we also need pyautogui to actually take the screenshot and save it to the local system. We also see the file dialog which allows users to save the file into the downloads folder.




1) Pip install tkinter

2) Pip install pyautogui


Source Code



In this block of code we are importing tkinter library and pyautogui library and we are making a simple window passing the width and height of the window as 300×300 and then we use the pack method to display the window. If you run this script you will see a window.


Now we are adding a simple button of Take screenshot with a green background color and a white foreground color We are using a button method of tkinter passing these arguments and then we are placing the button using create_window method passing x and y parameters and also the reference of the button. And we have defined a command which contains the custom function which will be executed when we click the button method : -> takeScreenshot in the next step we will write this function.



Now you can see we are taking the screenshot with the pyautogui library and then we are displaying a file dialog to save the file and passing a default extension of .png and then we are setting the file path to the save method of screenshot library pyautogui.


Whole Source Code:


Leave a Reply