# simple_dialogue.py
import tkinter as tk
import sys

def on_close():
    print("Dialog closed. Exiting script.")
    root.destroy()
    sys.exit()

# Create the main window
root = tk.Tk()
root.title("Simple Dialog")

# Set the size of the window
root.geometry("300x100")

# Add a label
label = tk.Label(root, text="Close this window to stop the script.")
label.pack(pady=20)

# Set the close event handler
root.protocol("WM_DELETE_WINDOW", on_close)

# Start the main event loop
root.mainloop()
