Python cannot compare Tkinter Value
Question: I am trying to get the value of "Dragon On" which should start off as "On". I
want to compare it to "Off" but it does not recognize the change. The second
time i press the button it will set textvariable to Off but the comparison
will not detected that it changed. I have also tried

    
    
    if (self.e3.config('textvariable')[-1] == 'Off')
    

But it just continues on.

    
    
    from Tkinter import *
    import time
    import datetime
    import threading
    import sys
    import pdb; 
    
    class App:
    
    dragon = 300
    
    def __init__(self, master):
    
        Label(master, text="Dragon Down").grid(row=2)
        self.e3 = Button(master,command=self.dragon_callback,width=15,text="Dragon On",textvariable="On")
        self.e4 = Entry(master)
    
        self.e3.grid(row=2, column=1)
        self.e4.grid(row=2, column=2)
    
    
    def dragon_callback(self):
        print "%s" % self.e3.config('textvariable')[-1]
      #  print sys._current_frames()
        if self.e3.config('textvariable')[-1]:
            print "inside here the variable is '%s' " % self.e3.config('textvariable')[-1]
            try:
                self.t2_stop = threading.Event()
                t = threading.Thread(target=self.dragon_time,name="Dragon Thread",args=("eee",self.t2_stop))
                t.daemon = True
                t.start()
            except:
                print "Error: unable to start thread"
            self.e3.config(textvariable='Off')
        else:
            print " i stopped"
            self.t2_stop.set()
            self.e4.delete(0, END)
            self.e3.config(textvariable='True')
    
    
    
    def dragon_time(self,bleh,stop_event):
        #print "did i get the value %s" % self.text_area.get()
        boom=300
        while(not stop_event.is_set() and boom > 0):
            #equivalent to time.sleep()
            self.e4.delete(0, END)
            self.e4.insert(0, boom)
            time.sleep(1)
            self.e4.delete(0, END)
            self.e4.insert(0, boom)
            boom -=1
            pass
    
    
    root = Tk()
    root.title("Timer")
    
    
    app = App(root)
    
    root.mainloop()
    


Answer: To make that comparison you must convert the object to a string

    
    
    if (str(self.e3.config('textvariable')[-1]) == 'Off'):
    

