I have an application which is about word manipulation, and I want to use it in order to look through a list of .txt files inside a subfolder(in this case is Used Words), and within each file, I need to look for a specific word. If I find that word, I want to get an error message indicating the word has already been used by the application before.
def buildShow():
    directory = "Used Words"
    if(os.path.exists(directory)):
        for files in os.walk(directory):
            for file in files:
                if file.endswith(".txt"):
                    tk.messagebox.showinfo("Warning", "World Already Used")
 
     
    