As the title suggests, I'm trying to make a counter with IntVar(),so I've tried this.
from tkinter import *
def main():
root = Tk()
root.resizable(FALSE, FALSE)
root.geometry('200x50')
root.title('Home')
#starts here
var = IntVar()
text = 'Count: ' + str(var.get())
b1 = Button(root, text='Test', command=fun)
b1.pack()
l1 = Label(root, text=text)
l1.pack()
mainloop()
def fun():
for i in range(1, 11):
print('test')
main()
But I got confused, I want to make it count the printings and show the value in the label.
Any help would be appreciated.