How do I create an automatically updating GUI using Tkinter?

后端 未结 5 1754
梦如初夏
梦如初夏 2020-11-30 10:40
from Tkinter import *
import time
#Tkinter stuff

class App(object):
    def __init__(self):
        self.root = Tk()

        self.labeltitle = Label(root, text=\"\         


        
5条回答
  •  眼角桃花
    2020-11-30 11:24

    I added a process bar in my window, and change its value according to randint for every 1 second using the update function:

    from random import randint
    def update():
        mpb["value"] = randint(0, 100) # take process bar for example
        window.after(1000, update)
    update()
    window.mainloop()
    

提交回复
热议问题