Why isn't my function returning anything?
<p>I am attempting to make a rudimentary chatbot using python and tkinter, and have ran into an issue. I have excluded tkinter code for simplicity. The entire code is visible at the bottom.</p>

<pre><code> def communicate():
        sent.set(HUMAN_ENTRY.get())
        bottalk(response)

        AI_RESPONSE.set(response.get())           
        print (response.get())            
        print(AI_RESPONSE.get())
        root.update()

 def bottalk(response):
        if sent == 'hello': 
            response = 'hello recieved'
        else:
           response = 'hello not recieved'
        return response

 AI_RESPONSE = 'hellgeto'
 header.pack()
 sent = StringVar()
 response = StringVar()
 AI_RESPONSE = StringVar()
</code></pre>

<p>An input is made into a entry box, and is sent to the communicate function, which sends the input to the bottalk function, which should set response to either "hello received" or "hello not received", and update a label on the GUI. However, when I do this, the label does not change, and the console outputs what seems to be two blank lines. <em>Why is my function not setting response to either "hello received" or "hello not received", and if it is, why is it not printing this or updating the GUI?</em></p>

<p><strong>Print(AI_RESPONSE) resulting in Py-Var2 was to show that 2 blank lines out outputted. My question does not concern that line.</strong></p>

<pre><code>from tkinter import *
import random


class App:
    def __init__(self, master):

    def close():
        quit()

    def communicate():
        sent.set(HUMAN_ENTRY.get())
        bottalk(response)

        AI_RESPONSE.set(response.get())           
        print (response.get())            
        print(AI_RESPONSE.get())
        print(AI_RESPONSE)
        root.update()

    def bottalk(response):
        if sent == 'hello': 
            response = 'hello recieved'
        else:
            response = 'hello not recieved'
        return response

    AI_RESPONSE = 'hellgeto'
    root.title=('GoBot')
    frame = Frame(master)
    frame.pack()
    self.button = Button(frame,text='Send', command=communicate)
    self.button.pack(side=LEFT)
    self.button2 = Button(frame,text='Quit', command=close)
    self.button2.pack(side=RIGHT)
    header = Label(frame, text='GoBot', fg= 'blue', font = 'Times')
    header.pack()
    sent = StringVar()
    response = StringVar()
    AI_RESPONSE = StringVar()
    HUMAN_ENTRY = Entry(master, bd = 5)
    HUMAN_ENTRY.pack(side=RIGHT)
    responselabel = Label(frame, textvariable=AI_RESPONSE, fg = 'purple', font = 'ComicSans', anchor ='s')
    responselabel.pack()




root = Tk()
app = App(root)      
root.mainloop()
</code></pre>

<p><a href="http://i.stack.imgur.com/GSOXj.png" rel="nofollow"><img src="http://i.stack.imgur.com/GSOXj.png" alt="The Console"></a></p>

<p>Ok from beginning, i think that you have few mistakes in your code:</p>

<pre><code>class App:
    def __init__(self, master):
</code></pre>

<p>You dont have anything in constructor, maybe you should put below code there:</p>

<pre><code>    AI_RESPONSE = 'hellgeto'
    root.title=('GoBot')
    frame = Frame(master)
    frame.pack()
    self.button = Button(frame,text='Send', command=communicate)
    self.button.pack(side=LEFT)
    self.button2 = Button(frame,text='Quit', command=close)
    self.button2.pack(side=RIGHT)
    header = Label(frame, text='GoBot', fg= 'blue', font = 'Times')
    header.pack()
    sent = StringVar()
    response = StringVar()
    AI_RESPONSE = StringVar()
    HUMAN_ENTRY = Entry(master, bd = 5)
    HUMAN_ENTRY.pack(side=RIGHT)
    responselabel = Label(frame, textvariable=AI_RESPONSE, fg = 'purple', font = 'ComicSans', anchor ='s')
    responselabel.pack()
</code></pre>

<p>Next method:</p>

<pre><code>    def close():
        quit()
</code></pre>

<p>probably you want to "clean" after object, then i recommend to read more about this, for example here: <a href="http://stackoverflow.com/questions/865115/how-do-i-correctly-clean-up-a-python-object">How do I correctly clean up a Python object?</a>
<br>
Also your another methods:</p>

<pre><code>    def communicate():
        sent.set(HUMAN_ENTRY.get())
        bottalk(response)

        AI_RESPONSE.set(response.get())           
        print (response.get())            
        print(AI_RESPONSE.get())
        print(AI_RESPONSE)
        root.update()

    def bottalk(response):
        if sent == 'hello': 
            response = 'hello recieved'
        else:
            response = 'hello not recieved'
        return response
</code></pre>

<p>I hardly recommend you first at all read about basics of python programming rather then start using some advanced modules. I want to redirect you here: <a href="https://docs.python.org/3/tutorial/classes.html" rel="nofollow">https://docs.python.org/3/tutorial/classes.html</a></p>

python tkinter