Python Forum
[Tkinter] Using Tkinter to calculate while formula
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Using Tkinter to calculate while formula
#2
Tkinter does not process events unless it is running imainloop(). You are blocking mainloop when you do this:
    while run == True:
        stroke_count += stroke_rate
        sleep(1)
If you want your tkinter program to do something every second you should look at .after()

And this is bad:
    lb2 = Label(root, print(str(stroke_count) +' stk'))
    lb2.grid(row=3, column=0)
Update the label text. Don't make another label.
Reply


Messages In This Thread
RE: Using Tkinter to calculate while formula - by deanhystad - Sep-03-2022, 03:53 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020