the tkinter label will not appear in a frame

a small fix gridding smallframe after initializing

from tkinter import *

root = Tk()
root.geometry('700x500')

# Big Frame
big_frame = LabelFrame(root, text='Big Frame', width=350, height=450, padx=5, pady=5)
big_frame.grid(row=0, column=0, padx=(1, 0), sticky='nsew')  # the sticky prevents the label from being inside the frame

root.rowconfigure(0, weight=1)
root.columnconfigure(0, weight=1)

# Small Frame
small_frame = LabelFrame(big_frame, text='Small Frame', width=120, height=200)
small_frame.grid(row=0, column=0)

label = Label(small_frame, text='Label')
label.grid(row=0, sticky='nw')


mainloop()

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top