简体   繁体   中英

Tkinter Loading wheel or progress bar

I want a python code to show a loading wheel or something on count down, currentry i'm using 3.2.1... count down but i want something like a loading wheel

    def button1Clicked():
        print("button was clicked")
        exitButton.pack_forget()
        startButton.pack_forget()
        start1Button.pack_forget()
        take1Photo(1)

def takePhoto(snap):
    if snap > 0:
        countdown(3)
        win.after(10000, takePhoto, snap-1)
    else:
        label["text"] = "Please wait..."
        win.after(100, assAndPrint)

def take1Photo(snap):
    if snap > 0:
        countdown(3)
        win.after(10000, take1Photo, snap-1)
    else:
        label["text"] = "Please wait..."
        win.after(100, assAndPrint1) 

Assuming "root" is your Tk Window, here's the simplest example on how you could do it :

p = Progressbar(root,orient=HORIZONTAL,length=200,mode="determinate",takefocus=True,maximum=100)
p.pack()            
for i in range(100):                
    p.step()            
    root.update()

Don't forget to import Progressbar :

from tkinter.ttk import Progressbar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM