def show_draft_input()

in tools/smol_tools/demo_tkinter.py [0:0]


    def show_draft_input(self, summary_x, summary_y, summary_width):
        draft_popup = tk.Toplevel(self.root)
        draft_popup.withdraw()  # Hide initially
        self.active_popups.append(draft_popup)
        draft_popup.title("Draft Reply")
        draft_popup.configure(bg='#f6f8fa')
        
        # Create frame for the two columns
        columns_frame = tk.Frame(draft_popup, bg='#f6f8fa')
        columns_frame.pack(expand=True, fill='both', padx=20, pady=20)
        
        # Calculate required height based on summary content
        num_lines = len(self.last_summary.split('\n'))
        line_height = max(num_lines * 1.5, 15)
        widget_height = min(line_height, 40) 
        
        # Column 1: Draft Input
        input_frame = tk.Frame(
            columns_frame,
            bg='white',
            highlightbackground='#e1e4e8',
            highlightthickness=1,
            bd=0,
            relief=tk.FLAT
        )
        input_frame.pack(side=tk.LEFT, padx=5, fill='both', expand=True)
        tk.Label(input_frame, text="Your Reply", bg='white', fg='#24292e', font=('Segoe UI', 12)).pack(padx=15, pady=(12,0), anchor='w')
        text_input = tk.Text(
            input_frame, 
            height=widget_height, 
            width=30, 
            wrap=tk.WORD,
            borderwidth=0,
            highlightthickness=0,
            selectbackground='#e1e4e8',
            selectforeground='#24292e',
            insertwidth=2,  # Width of cursor
            insertbackground='#0066FF',  # Color of cursor matching our theme
            insertofftime=500,  # Cursor blink off time in milliseconds
            insertontime=500   # Cursor blink on time in milliseconds

        )
        text_input.pack(fill='both', expand=True, padx=15, pady=12)
        text_input.config(bg='white', fg='#24292e', font=('Segoe UI', 12))
        
        # Column 2: Improved Text
        improved_frame = tk.Frame(
            columns_frame,
            bg='white',
            highlightbackground='#e1e4e8',
            highlightthickness=1,
            bd=0,
            relief=tk.FLAT
        )
        improved_frame.pack(side=tk.LEFT, padx=5, fill='both', expand=True)
        tk.Label(improved_frame, text="Improved Reply", bg='white', fg='#24292e', font=('Segoe UI', 12)).pack(padx=15, pady=(12,0), anchor='w')
        improved_text = tk.Text(
            improved_frame, 
            height=widget_height, 
            width=30, 
            wrap=tk.WORD,
            borderwidth=0,
            highlightthickness=0,
            selectbackground='#e1e4e8',
            selectforeground='#24292e'
        )
        improved_text.pack(fill='both', expand=True, padx=15, pady=12)
        improved_text.config(state='disabled', bg='white', fg='#586069', font=('Segoe UI', 12))
        
        # Add Copy button using tkmacosx
        copy_btn = Button(
            improved_frame, 
            text="Copy",
            command=lambda: pyperclip.copy(improved_text.get("1.0", "end-1c")),
            font=('Segoe UI', 14),
            bg='#0066FF',
            fg='white',
            activebackground='#0052CC',
            activeforeground='white',
            borderless=True,
            focuscolor='',
            padx=20,
            pady=8,
            cursor='hand2'
        )
        copy_btn.pack(pady=(0, 12))
        
        # Add "Smol Improvement?" button using tkmacosx
        improve_btn = Button(
            input_frame, 
            text="Smol Improvement?",
            command=lambda: self.generate_improved_text(
                text_input.get("1.0", "end-1c"),
                improved_text),
            font=('Segoe UI', 14),
            bg='#0066FF',
            fg='white',
            activebackground='#0052CC',
            activeforeground='white',
            borderless=True,
            focuscolor='',
            padx=20,
            pady=8,
            cursor='hand2'
        )
        improve_btn.pack(pady=(0, 12))
        
        # Position window relative to the summary window's position
        draft_popup.update_idletasks()
        screen_width = draft_popup.winfo_screenwidth()
        screen_height = draft_popup.winfo_screenheight()
        popup_width = draft_popup.winfo_width()
        if popup_width == 1:
            popup_width = 800
        popup_height = draft_popup.winfo_height()
        
        # Calculate center point of the summary window
        summary_center_x = summary_x + summary_width//2
        
        # Center the new window on the same point, but ensure it stays on screen
        new_x = max(min(summary_center_x - popup_width//2, screen_width - popup_width), 0)
        # Position vertically based on screen space available
        if summary_y > screen_height / 2:
            new_y = max(summary_y - popup_height - 10, 0)  # 10px gap above summary
        else:
            new_y = min(summary_y + 10, screen_height - popup_height)  # 10px gap below summary
        
        draft_popup.geometry(f"+{new_x}+{new_y}")
        draft_popup.deiconify()