File size: 1,940 Bytes
7f5ef51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import tkinter as tk
from tkinter import scrolledtext, messagebox

class CodetteApp(tk.Tk):
    def __init__(self):
        super().__init__()
        self.title("Codette Universal Reasoning Assistant")
        self.geometry("600x400")
        self.configure(bg="#eef6f9")

        # Title label
        title = tk.Label(self, text="Ask Codette", font=("Helvetica", 18, "bold"), bg="#eef6f9")
        title.pack(pady=10)

        # Input field
        self.input_field = tk.Entry(self, font=("Calibri", 14), width=60)
        self.input_field.pack(pady=5)
        self.input_field.focus()

        # Ask button
        ask_btn = tk.Button(self, text="Ask", font=("Calibri", 12), command=self.handle_ask)
        ask_btn.pack(pady=5)

        # Output box
        output_label = tk.Label(self, text="Codette's Answer:", bg="#eef6f9")
        output_label.pack()
        
        self.output_box = scrolledtext.ScrolledText(self, font=("Consolas", 12), height=10, width=70)
        self.output_box.pack(pady=4)

        # Clear button
        clear_btn = tk.Button(self, text="Clear", command=self.clear_all)
        clear_btn.pack(pady=3)

    def handle_ask(self):
        user_query = self.input_field.get().strip()
        if not user_query:
            messagebox.showwarning("Input Required", "Please enter your question.")
            return
        
        # TEMP: Dummy response until we connect to AI backend logic.
        codette_reply = f"[Pretend answer] You asked: '{user_query}'"
        
        self.output_box.insert(tk.END, f"User: {user_query}\nCodette: {codette_reply}\n\n")
        self.out_box_yview_bottom()

    def out_box_yview_bottom(self):
        ''' Scroll output box to bottom '''
        self.output_box.yview_moveto(1.0)

    def clear_all(self):
        self.input_field.delete(0, tk.END)
        self.output_box.delete('1.0', tk.END)

if __name__ == "__main__":
    app = CodetteApp()
    app.mainloop()