import tkinter as tk
class HelloWorld(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
self.entry = tk.Entry(self)
self.button = tk.Button(self, text="What's your input?", command=self.on_button)
self.button.pack()
self.entry.pack()
def on_button(self):
answer = self.entry.get()
if answer =="a":
print("Hello World")
elif answer =="b":
print("Hello World 2")
elif answer =="c":
root.destroy()
root = HelloWorld()
root.mainloop()