Python Forum
Show the result of every count
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Show the result of every count
#1
I try to make a simple program. Up button count the number and show the result on screen. Same with the down button. My problem is that my program count them in the background and shows only the last result (1000). Any idea how to say to my program "On every step show the new number in label"

from tkinter import *

root = Tk()

number = 0

label = Label (root, text=number).grid(row=0, column =1)

def up():
    number = 0
    while number < 1000:
        number = number + 1
        print (number)
        label = Label (root, text=number).grid(row=0, column =1)

button1 = Button(root, text="UP", command=up)
button2 = Button(root, text="DOWN")
button3 = Button(root, text="QUIT", command=quit)

button1.grid(row=1, column=0)
button2.grid(row=1, column=1)
button3.grid(row=1, column=2)

root.mainloop()
Reply


Messages In This Thread
Show the result of every count - by George87 - Dec-28-2021, 11:42 AM
RE: Show the result of every count - by menator01 - Dec-28-2021, 01:48 PM
RE: Show the result of every count - by George87 - Dec-28-2021, 02:17 PM
RE: Show the result of every count - by menator01 - Dec-28-2021, 03:36 PM
RE: Show the result of every count - by menator01 - Dec-28-2021, 04:00 PM
RE: Show the result of every count - by George87 - Dec-28-2021, 05:16 PM
RE: Show the result of every count - by deanhystad - Dec-28-2021, 05:33 PM
RE: Show the result of every count - by menator01 - Dec-28-2021, 06:04 PM
RE: Show the result of every count - by deanhystad - Dec-28-2021, 08:58 PM
RE: Show the result of every count - by menator01 - Dec-28-2021, 09:04 PM
RE: Show the result of every count - by deanhystad - Dec-28-2021, 10:03 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] How to get the result of a ping to show in tkinter? jacklee26 6 7,881 Feb-10-2023, 01:12 PM
Last Post: NebularNerd

Forum Jump:

User Panel Messages

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