(event=None)
| 24 | |
| 25 | |
| 26 | def on_send(event=None): # event is passed by binders. |
| 27 | message = user_input.get() |
| 28 | if message: # Only process if there's a message |
| 29 | # Display user message in the chat window |
| 30 | chat_window.configure(state=tk.NORMAL) # Temporarily make it editable |
| 31 | chat_window.insert(tk.END, f"You: {message}\n") |
| 32 | chat_window.configure(state=tk.DISABLED) # Make it read-only again |
| 33 | |
| 34 | # Clear the user input field |
| 35 | user_input.delete(0, tk.END) |
| 36 | |
| 37 | # Generate and display chatbot response |
| 38 | response = generate_response(message) |
| 39 | chat_window.configure(state=tk.NORMAL) |
| 40 | chat_window.insert(tk.END, f"WebIdeasBot: {response}\n") |
| 41 | chat_window.configure(state=tk.DISABLED) |
| 42 | |
| 43 | |
| 44 | # Create the main window |
nothing calls this directly
no test coverage detected