title: python button change text after click
body: <p>i want to make a Button that changes the displayed text(number) after every click and returns the valure defined in the function, because i want to work with the displayed variables.</p>
  
  <p>I created a function that adds +1 to "text" after every click until 4
  and a button. The code does not return the valure of the function and the button has only the text = 1,2,3 or 4.</p>
  
  <pre><code>import tkinter as tk
  
  root = tk.Tk()
  
  text = 0
  def text_change():
      global text
      text += 1
  
      print(text)
      if text &gt;= 4:
          text = 0
  
  #to change: button text has to be the variable defined in the function
  btn = tk.Button(text = "1,2,3 or 4", width = 10, height = 3, command = \
                  text_change).grid(row = 1 , column = 1)
  
  root.mainloop()
  </code></pre>
  
  <p>I hope you can help me :)</p>