import tkinter as tk
from tkinter import simpledialog
from tkinter import messagebox

class NoteApp(tk.Tk):
    def __init__(self):
        super().__init__()
        self.title('Note Taking Application')
        self.geometry('400x300')
        
        self.notes = {}
        
        self.initialize_ui()
        
    def initialize_ui(self):
        self.listbox = tk.Listbox(self)
        self.listbox.pack(fill=tk.BOTH, expand=True)
        
        self.menu = tk.Menu(self)
        self.config(menu=self.menu)
        
        file_menu = tk.Menu(self.menu, tearoff=0)
        self.menu.add_cascade(label='File', menu=file_menu)
        file_menu.add_command(label='New Note', command=self.create_note)
        file_menu.add_command(label='Delete Note', command=self.delete_note)
        file_menu.add_command(label='Edit Note', command=self.edit_note)
        
    def create_note(self):
        title = simpledialog.askstring("Title", "Enter note title:")
        if title:
            content = simpledialog.askstring("Content", "Enter note content:")
            self.notes[title] = content
            self.listbox.insert(tk.END, title)
    
    def delete_note(self):
        try:
            index = self.listbox.curselection()[0]
            title = self.listbox.get(index)
            del self.notes[title]
            self.listbox.delete(index)
        except IndexError:
            messagebox.showerror("Error", "Please select a note to delete.")
    
    def edit_note(self):
        try:
            index = self.listbox.curselection()[0]
            title = self.listbox.get(index)
            new_content = simpledialog.askstring &#8203;``【oaicite:0】``&#8203;
