I am trying to make this code to later integrate with some structures calculations.
I want to delete all widgets in the root when I press Section Properties. And then I want to write new widgets but outside of the function. I can't get it to work.
from tkinter import *
from PIL import Image, ImageTk
#set up the environment - root
root = Tk()
root.title('Statics Calculator - Menu')
root.geometry("500x500")
root.iconbitmap(r'C:\Users\Jaume\OneDrive\JAUME\SES MEVES COSES\Nabla yacht design.ico')
#welcome user
welcome = Label(root, text='Welcome to Statics Calculator', font=(20)).pack()
mode = Label(root, text='How Can I Help You?', font=(20)).pack()
#background image
back_img = ImageTk.PhotoImage(Image.open('Golden bridge1.png'))
back_image = Label(image=back_img)
back_image.place(x=0, y=110, relwidth=1)
def opensections():
for widget in root.winfo_children():
widget.destroy()
root.title("Statics Calculator - Section Properties")
global sections_frame
sections_frame = Frame(root, width=500, height = 00).pack()
sections = Button(root, text='Section Properties', command=opensections).pack()
sections_module_label = Label(sections_frame, text ="You Are Now In The Section Properties Module", font=10).pack(side=TOP)