I cant make a label in tkinter. I found out that the label will only appear if i change pass
to child.destroy()
(in comments in code) I have no idea why the label is not appearing.
import tkinter as tk
from tkinter import *
from tkinter.ttk import *
def saved_page():
for child in root.winfo_children():
if child == nameF or menuF or infoF:
pass # if i turn this pass into child.destroy() only then the label will appear
else:
child.destroy()
infoL = Label(root, text = 'BlaBla')
infoL.pack(pady = 100)
def home_page():
global nameF, menuF, infoF
root.overrideredirect(False)
for child in root.winfo_children():
child.destroy()
# Frames
nameF = tk.Frame(root, width = 900, height = 30)
nameF.pack(fill = 'x', expand = False, side = 'top')
menuF = Frame(root, width = 75, height = 500)
menuF.pack(anchor = 'w')
menuF.pack_propagate(0)
infoF = Frame(root, width = 900 - 75, height = 500 - 30)
infoF.pack()
infoF.pack_propagate()
nameL = Label(nameF, text = 'KM - Bot 5')
nameL.pack(anchor = 'nw', padx = 10)
homeB = Button(menuF, text = 'Home')
recordB = Button(menuF, text = 'Record')
savedB = Button(menuF, text = 'Saved', command = saved_page)
updateB = Button(menuF, text = 'Update')
settingB = Button(menuF, text = 'Settings')
homeB.pack(pady = 10)
recordB.pack(pady = 10)
savedB.pack(pady = 10)
updateB.pack(pady = 10)
settingB.pack(fill = 'x', expand = False, side = 'bottom', pady = 10)
# starts the application intro
def start_intro():
l1 = Label(root, text = 'This App')
l1.pack()
root.after(1000, home_page)
# seting up the window
root = Tk()
root.title('App')
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
w = 900
h = 500
x = (screen_width / 2) - (w / 2)
y = (screen_height / 2) - (h / 2)
root.geometry('%dx%d+%d+%d' % (w, h, x, y))
root.minsize(w, h)
#root.maxsize(w, h)
root.overrideredirect(True)
start_intro()
root.mainloop()