from tkinter import *

# الشاشة الرئسية 
wendow = Tk()
wendow.title("Palindrome Checker")
wendow.geometry("400x100")
wendow.resizable(True,False) # منع توسيع الشاشة 
wendow.configure(bg="#9c937b") # لون 

# شاشة العرض Label
myLabel = Label(wendow,text="Palindrome Checker",bg="#9c937b",fg="#302401",font="Euphemia 15 bold")
myLabel.pack()

# اطلب من المستخدم ان يكتب الكلمة 
myTxt = Entry(wendow,width="50")
myTxt.pack(side="right", padx=10, pady=10,fill=X,expand=True )

def word():
    word_input = str(myTxt.get()).lower().strip()
    # عكس الكلمة 
    list_word = list(word_input).copy() 
    list_word.reverse() 

    if word_input != "":
        # إذا كانت الكلمة وعكسها متطابقين
        if list(word_input) == list_word:
            myLabel.config(text=f"{myTxt.get()} is a Palindrome.")

        # إذا كانت الكلمة وعكسها ليست متطابقين
        else:
            myLabel.config(text=f"{myTxt.get()} is not a Palindrome.")

# Button
myButton = Button(wendow,text="Enter a word:", width=10,fg="#b0a68d", bg="#524d38",command= lambda:word())
myButton.pack(side="left")

wendow.mainloop()