Skip to content
Permalink
Browse files
Created GUITest1
Experimenting with different GUI elements, can be ignored by anyone not working on the GUI
  • Loading branch information
hortonr6 committed Nov 1, 2017
1 parent 96b1462 commit f486be96eaec4a721feb65f9fd826d5a082c2392
Showing 1 changed file with 28 additions and 0 deletions.
@@ -0,0 +1,28 @@
import random
import tkinter as tk

root = tk.Tk()
userInput = tk.Entry(root)
userInput.pack()

greetings = ['hola', 'hello', 'hi', 'hey!', 'hey']
question = ['how are you?', 'how are you doing?', 'how are you', 'how are you doing']
responses = ['Okay', "I'm fine"]
huh = "I did not understand what you said"

def cb(event):
userText = userInput.get()
userText = userText.lower()
if userText in greetings:
botText = random.choice(greetings)
elif userText in question:
botText = random.choice(responses)
else:
botText = huh
output.config(text=botText)

userInput.bind("<Return>", cb)
output = tk.Label(root, text='')
output.pack()

tk.mainloop()

0 comments on commit f486be9

Please sign in to comment.