I have been reading about refreshing tkinter windows but all the examples I have found have been for changing the color of a screen or updating a line of text. I have a problem where I need to update a set of dynamically created buttons. In my example, the user chooses a directory and then the buttons are created based on the files in the directory. They can change the directory multiple times so the buttons need to change. Here is what I'm working with:
Here's an example of the buttons being created that I need to update.
def restore(self):
self.restoreWindow = Toplevel()
self.restoreWindow.grab_set()
self.restoreWindow.transient(root)
chooseFrame = Frame(self.restoreWindow)
chooseFrame.pack(fill=X, expand=True)
message = "Select an available Backup to Restore to."
Label(chooseFrame, text=message).pack()
button_list = []
button_num = -1
os.chdir('C:\\')
for name in os.listdir('.'):
if os.path.isdir(name):
button_list.append(name)
self.button = Button(chooseFrame, text=name,command=lambda j=button_num+1:
self.restoreCallBack(button_list[j]))
self.button.pack(side=LEFT, padx=10, pady=10)
button_num = button_num + 1
os.chdir('..')
Thanks for all your help, let me know of any questions!