MCPcopy Index your code
hub / github.com/ndleah/python-mini-project / on_send

Function on_send

simple-chatbot/chatbot.py:26–41  ·  view source on GitHub ↗
(event=None)

Source from the content-addressed store, hash-verified

24
25
26def 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

Callers

nothing calls this directly

Calls 2

generate_responseFunction · 0.85
insertMethod · 0.80

Tested by

no test coverage detected