简体   繁体   中英

Python tkinter time.sleep() alternative

I'm using tkinter for gui programming. I have a data frame, I get each data here with a 'for' loop. But I want it to wait 1 second for each data, but tkinter is not responding because I use 'time.sleep'. I will hold 1 second for each data and is there an alternative that won't freeze the 'tkinter'?

import pandas as pd 
from tkinter import * 

def print_rows(startRow):
    df = pd.read_excel(r'./x.xlsx')   
    for row in df.itertuples():
        if row.Index >= int(startRow):
            L1.config(text=str(row.Index)+'-'+ row.email)
            window.update_idletasks()
            time.sleep(1)
x = Tk()
x.after(miliseconds,function)

That's pretty much it.

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