Python 3 Tkinter PyAutoGUI Script to Capture Screen as PNG Image File on Button Click GUI Desktop App Full Project For Beginners



pip install pyautogui



Now make an file and copy paste the following code



import pyautogui   # import PyAutoGUI library
import tkinter as tk  # import tkinter library
# create main window
window = tk.Tk()
# define a method that will call whenever button will be clicked
def take():
    image = pyautogui.screenshot("tkscreen.png")
# create a button 
shot_btn = tk.Button(window,text = "Take Screenshot", command= take)
# place the button on the window, y=50)




Leave a Reply