I want to ask that if I click on a button, then it perform a command and if I click again on the button then it perform another command. Basically I have two commands which I want to use in loop.
#Import tkinter here
from tkinter import *
#defining root function.
root = Tk()
root.geometry('200x100')
#define fuction for labelA
def funcA():
labelA["text"] = "A responds"
#define fuction for labelB
def funcB():
labelB["text"] = "B responds"
#Define button.
button = Button(root, text = 'Click Me', command=lambda:[funcA(), funcB()])
button.pack()
#creating both label A and B
labelA = Label(root, text="A")
labelB = Label(root, text="B")
labelA.pack()
labelB.pack()
root.mainloop()
In this code when I click on button, both the function run at same time. But I want that when I click on the button, the first function should run and if I click again on button then run second function. This will be in loop (like first of all first label will update then second label will update then again first label update then again second label).