import tkinter as tk
from tkinter import messagebox, ttk

class SaneUI:
    def __init__(self, root):
        self.root = root
        self.root.title("Sane UI")
        self.root.geometry("600x400")

        # Create main UI components
        self.create_menu()
        self.create_toolbar()
        self.create_status_bar()
        self.create_main_frame()

    def create_menu(self):
        """Create the menu bar."""
        menubar = tk.Menu(self.root)

        file_menu = tk.Menu(menubar, tearoff=0)
        file_menu.add_command(label="New", command=self.new_file)
        file_menu.add_command(label="Open", command=self.open_file)
        file_menu.add_separator()
        file_menu.add_command(label="Exit", command=self.root.quit)
        menubar.add_cascade(label="File", menu=file_menu)

        help_menu = tk.Menu(menubar, tearoff=0)
        help_menu.add_command(label="About", command=self.show_about)
        menubar.add_cascade(label="Help", menu=help_menu)

        self.root.config(menu=menubar)

    def create_toolbar(self):
        """Create a simple toolbar."""
        toolbar = tk.Frame(self.root, bd=1, relief=tk.RAISED)

        new_button = tk.Button(toolbar, text="New", command=self.new_file)
        new_button.pack(side=tk.LEFT, padx=2, pady=2)

        open_button = tk.Button(toolbar, text="Open", command=self.open_file)
        open_button.pack(side=tk.LEFT, padx=2, pady=2)

        toolbar.pack(side=tk.TOP, fill=tk.X)

    def create_status_bar(self):
        """Create a status bar at the bottom of the window."""
        self.status = tk.StringVar()
        self.status.set("Welcome to Sane UI")

        status_bar = tk.Label(self.root, textvariable=self.status, bd=1, relief=tk.SUNKEN, anchor=tk.W)
        status_bar.pack(side=tk.BOTTOM, fill=tk.X)

    def create_main_frame(self):
        """Create the main content area."""
        main_frame = ttk.Frame(self.root, padding="10")
        main_frame.pack(fill=tk.BOTH, expand=True)

        label = ttk.Label(main_frame, text="This is the main content area.")
        label.pack(pady=10)

        self.text_area = tk.Text(main_frame, wrap=tk.WORD, height=15, width=50)
        self.text_area.pack(pady=10)

        button = ttk.Button(main_frame, text="Submit", command=self.submit_action)
        button.pack(pady=10)

    def new_file(self):
        """Clear the text area for a new file."""
        self.text_area.delete(1.0, tk.END)
        self.status.set("New file created.")

    def open_file(self):
        """Simulate opening a file."""
        messagebox.showinfo("Open File", "This is a placeholder for file opening.")
        self.status.set("Opened a file.")

    def submit_action(self):
        """Handle the submit button action."""
        content = self.text_area.get(1.0, tk.END).strip()
        if content:
            messagebox.showinfo("Submission", f"You entered:\n{content}")
            self.status.set("Content submitted.")
        else:
            messagebox.showwarning("Submission", "The text area is empty.")
            self.status.set("Submission failed.")

    def show_about(self):
        """Display an About dialog."""
        messagebox.showinfo("About", "Sane UI\nVersion 1.0\nA simple UI built with Tkinter.")

if __name__ == "__main__":
    root = tk.Tk()
    app = SaneUI(root)
    root.mainloop()
