tkinter: progress list not updating
NickName:Matthijs Ask DateTime:2015-06-11T05:45:53

tkinter: progress list not updating

I have great difficulty boiling down my problem into a fundamental one, so my apologies if this is already treated in another question.

My problem lies in providing progress feedback to the user. The basic system is used to import files, analyze them (with an external function) and in the end produce an output file. During the analysis i would like to let the user know which files have already been analysed.

The GUI consist of two listboxes: the left one shows the files chosen for analysis and the right one should show the files which have been analyzed. The button in the bottom starts the analysis.

The problem is that the progress list only updates after the for loop is completed and not in between.

Help is much appreciated as i have been stuck quite a while now.

The main file:

from Tkinter import *
from ext_function import Xfunct
import tkFileDialog
import time

root=Tk()
width=3;
files=Frame(root, relief=GROOVE,borderwidth=width)
progress=Frame(root, relief=GROOVE,borderwidth=width)
analysis=Frame(root)

global fl_paths
global fl_names
fl_paths=[]
fl_names=[]

#################  Functions #################

def f_load_files():
    temp = root.tk.splitlist(tkFileDialog.askopenfilenames(parent=root,title='Select files'))
    temp_list=list(temp)

    for i in range(len(temp_list)):
        fl_names.append(temp_list[i].split('/')[-1])
        fl_paths.append(temp_list[i])
        file_list.insert(END, fl_names[-1])

def f_run():
    for i in range(len(fl_names)):
        Xfunct(i) #call the function
        prog_list.insert(END,fl_names[i])#update the list in the progress box           

#################  File selection frame #################
files_name=Label(files,text='File selection:')
files_name.grid(column=0,row=0)
file_list=Listbox(files)
file_list.grid(column=0, row=1, columnspan=2, rowspan=4,pady=3, padx=10)
load_files=Button(files,text='Load files',command=f_load_files)
load_files.grid(column=0,row=5, padx=3, pady=6)

################# Progress #################
progress_name=Label(progress,text='Done:')
progress_name.grid(column=0,row=0, columnspan=3)
prog_list=Listbox(progress)
prog_list.grid(column=0, row=1, columnspan=3, padx=10)

################# Analysis #################
start_analysis=Button(analysis,text='Make Analysis',command=f_run)
start_analysis.grid(column=4, row=1, rowspan=10, padx=10)

################# Align frames #################
files.grid(row=0, column=0, padx=10, pady=10, sticky=N+S+W+E)
progress.grid(row=0, column=1, pady=10, padx=10, sticky=N+S+W+E)
analysis.grid(row=2,column=0, columnspan=2, padx=10, pady=10)

mainloop()

The external function called Xfunct, located in a file called ext_funct.py:

def Xfunct(i):
    import time

    print i
    time.sleep(3)

Copyright Notice:Content Author:「Matthijs」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30767862/tkinter-progress-list-not-updating

More about “tkinter: progress list not updating” related questions

tkinter: progress list not updating

I have great difficulty boiling down my problem into a fundamental one, so my apologies if this is already treated in another question. My problem lies in providing progress feedback to the user. ...

Show Detail

tkinter updating progress bar on thread progress

from tkinter import * from tkinter.ttk import * import threading import numpy as np def bar(): #function to display progress pass with open('/home/user154/test.txt') as f: total=f.read().

Show Detail

insert a tkinter progress bar in a List Comprehensions of Python

Normally i use a simple loop to insert a indeterminate progress bar in tkinter. example self.pbar_ind = ttk.Progressbar(self, orient="horizontal", length=300, mode="indeterminate") new_point_in_...

Show Detail

How to update the ttk progress bar on tkinter

I've got a program that does some simple webscraping. I'm working on giving it to my coworkers to use, but they are unfamiliar with code so I'd like to make a GUI. I've started using tkinter, and I'm

Show Detail

Updating a tkinter progress bar in python 3.7

I'm new to python development and have had some issues with finding resources on this issue. I am trying to create a progress bar that opens up in its own gui. I've heard that the best way to do th...

Show Detail

Tkinter progress bar not updating during task

I'm using pytube and tkinter to create a GUI for downloading YouTube videos. progressbar=ttk.Progressbar(window, orient=HORIZONTAL, length=200, mode='determinate') progressbar.place(x=175, y=200, a...

Show Detail

Updating progress bar in Tkinter simultaneously while recording audio Python3

My goal for this simple program is to be able to show a progress bar of time the mic has been recording(range from 0 - 30 seconds). I am using the Tkinter library, Python 3.6, and PyAudio to record...

Show Detail

Circular progress bar using Tkinter?

I want to add a Circular progress bar to my Python GUI using Tkinter, but I didn't find any documentation for Circular progress bars with Tkinter. How can I create a Circular progress bar in Tkint...

Show Detail

tkinter progress bar with file list

I have a loop that read files in python like below: def Rfile(): for fileName in fileList: …. How can I add a tkinter progress bar that will be linked to the for loop and the size of the fil...

Show Detail

Tkinter - Trouble Tracking Progress with Label

I am using the tkinter GUI package in python and would like to track the progress of a process that loops through a list and does something for each item on the list. I want to track the progress i...

Show Detail