Why, in this really basic code snippet, the data label (lb_data) is not appearing in its parent widget (fr_body), and instead appears in fr_header?
(The heights, widths and reliefs are just there to show the location of the Frame widgets)
fr_header=ttk.Frame(root,width=100,height=100,relief=GROOVE).grid(row=0,column=0)
lb_title=ttk.Label(fr_header,text="Title Title Title").grid(row=0,column=0)
fr_body=ttk.Frame(root,width=150,height=150,relief=SUNKEN).grid(row=1,column=0)
lb_data=ttk.Label(fr_body,text="Data").grid(row=0,column=0)
The
.gridmethod returnsNone. So,fr_headeris actually being assigned the valueNone. When you pass that to your labelTkintersees theNoneand assumes you want to make the master widget the root widget (Tk()).I never create a widget and
gridat the same time as then you lose your easy handle on the widget you just created. Do it this way instead: