title: Check state of button in tkinter
body: <p>On a tkinter GUI I want to print different messages on a canvas depending on the state of a button I hover over. If the button itself is DISABLED, I want to display another message on the canvas than when the button is NORMAL.
  I have this (stripped) relevant code:</p>
  
  <pre><code>from tkinter import *
  
  class app:
      def __init__(self):
          self.window = Tk()
          self.button = Button(self.window,text="Button",command=self.someCommand,state=DISABLED)
  
          self.button.bind("&lt;Enter&gt;", self.showText)
          self.button.bind("&lt;Leave&gt;", self.hideText)
  
          self.window.mainloop()
  
      def showText(self):
          if self.button["state"] == DISABLED:
              #print this text on a canvas
          else:
              #print that text on a canvas
  
      def hideText(self):
          #remove text    
  
  def main()
      instance = app()
  
  main()
  </code></pre>
  
  <p>This always draws 'that text' on the canvas, instead of 'this text'</p>
  
  <p>I have tried the following too:</p>
  
  <pre><code> self.button['state']
   == 'disabled'
   == 'DISABLED'
  </code></pre>
  
  <p>if I print:</p>
  
  <pre><code>print(self.button["state"] == DISABLED)
  </code></pre>
  
  <p>it gives me:</p>
  
  <pre><code>False
  </code></pre>
  
  <p>Changing the state using:</p>
  
  <pre><code>self.button["state"] = NORMAL
  </code></pre>
  
  <p>works as I would expect.</p>
  
  <p>I have read through a few topics here but none seem to answer the question to why the if-statement doesn't work.</p>