I am building an image processing methods GUI in that I have created some frames to show various methods in each frame as a tab using the notebook functionality of the Tkinter. How can I create a function that deletes all four frames, so that when I import the second image the first one will be removed and the newly imported image is added to the frames?
I have tried the winfo_children function to destroy frames but it only works for one frame at a time. I also tried looping through all frames. my skills are not sufficient to think through this one. So, I need a suggestion or anything that I m missing.
Thank you so much for your time any help is appreciated.
tabControl = ttk.Notebook(root)
tab1 = ttk.Frame(tabControl)
tab2 = ttk.Frame(tabControl)
tab3 = ttk.Frame(tabControl)
tab4 = ttk.Frame(tabControl)
tabControl.add(tab1, text='Imported Image')
tabControl.add(tab2, text='Method 1')
tabControl.add(tab3, text='Method 2')
tabControl.add(tab4, text='Method 3')
tabControl.pack(expand=1, fill="both")
frame1_title= tk.Label(tab1,bd=10)
frame1_title.pack(fill='both', expand=True)
frame2_title= tk.Label(tab2, font='times 35')
frame2_title.pack(fill='both', expand=True)
frame3_title= tk.Label(tab3,font='times 35')
frame3_title.pack(fill='both', expand=True)