Progress bar on Tkinter

1

I need to create a progress bar, because I have a small window in TKinter where I upload an excel file in a panda dataframe containing about 350,000 records and it takes a long time to load it, so I want to enter a progress bar in that time , but I do not know how to capture the time it takes to load or the size of the file to load the bar.

#Librerias
import pandas as pd
import numpy as np
from tkinter import *
from tkinter import ttk
from tkinter import filedialog

#Funciones
ruta = ''
def abrir():
    '''
    Regresa la ruta absoluta del archivo
    '''
    global ruta
    ruta = filedialog.askopenfilename(title="Abrir",filetypes = (("Fichero Excel 97-2003","*.xls"),("Fichero Excel","*.xlsx")))


#Ventana principal
root = Tk()

#Propiedades Ventanas
root.title('Report')
root.resizable(0,0)
root.geometry('200x200')

#Botones
    #Abrir archivo
l1 = Label(root, text="Agrega el archivo")
l1.pack()
b1 = Button(root,text="Abrir", command=abrir, width='10')
b1.pack()
    #Barra de progreso
pb = ttk.Progressbar(root, mode='indeterminate')
pb.pack()


#Loop Principal
root.mainloop()
    
asked by Javier Arturo Hernández Sosa 09.12.2017 в 03:29
source

0 answers