Simple gpio button

#!/home/user_name/venv/bin/python3.11


#######################################################
# 🐍             The Best Practice                🐍  #
#    ____          _         ____            __ _     #
#   / ___|___   __| | ___   / ___|_ __ __ _ / _| |_   #
#  | |   / _ \ / _` |/ _ \ | |   | '__/ _` | |_| __|  #
#  | |__| (_) | (_| |  __/ | |___| | | (_| |  _| |_   #
#   \____\___/ \__,_|\___|  \____|_|  \__,_|_|  \__|  #
#  for Source code visit  raspi.x7-1.com              #                                   
#######################################################
 

import tkinter as tk
import RPi.GPIO as GPIO

# Setup GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(24, GPIO.OUT)
GPIO.output(24, GPIO.HIGH) #set state



def close():
    #Perform any cleanup tasks
    GPIO.cleanup(24)  # Reset the GPIO pins or single pin
    root.destroy()  # Close the GUI
 


root = tk.Tk()
root.geometry('600x400')
root.title("simple button")
root.configure(bg="black")


# 🔥 Bind the window close event to your cleanup function
root.protocol("WM_DELETE_WINDOW", close) 

def led1():
    print("LED button pressed")
    if GPIO.input(24):
        GPIO.output(24, GPIO.LOW)
        btn1.configure(text='LED Off')
    else:
        GPIO.output(24, GPIO.HIGH)
        btn1.configure(text='Led On')
        
        

btn1 = tk.Button(root, text = "LED1", font = ("Arial",18), command = led1, height = 1, width =8,
bg = '#003333',fg="green",activeforeground="#00ff00",activebackground="black")
btn1.pack(pady=25)        
        
        
root.mainloop()