I am trying to create a simple GUI using Tkinter. I created a label with a text. This text should be changed when a button (physical) is pressed. I read about using the after() method, but it only runs a method ones, it should always check for user input.
while 1:
root = tk.Tk()
GPIO.setmode(GPIO.BCM)
GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
input_state = GPIO.input(21)
menutxt = tk.StringVar()
menuLabel = tk.Label(root, textvariable=menutxt).pack()
if input_state == False:
menutxt.set("TEXT2")
else:
menutxt.set("TEXT1")
root.mainloop()