What\'s the difference between packing a frame \"in line\" versus =\'ing it to a variable and .pack\'ing it on the next line?
So I saw how to do grid and pack at the sa
In the second example:
f5 = Frame(mainF, bg = "yellow", height=100, width = 60).pack(side=BOTTOM,fill=NONE)
f5 is None. This is not the case in the first example:
f5 = Frame(mainF, bg = "yellow", height=100, width = 60)
f5.pack(side=BOTTOM,fill=NONE)
In short terms, the "in line" method is not-recommended. It is one of the most common mistakes and causes of headache for new users of tkinter in python.
The reason for None
is very simple: pack()
and grid()
return None.
In your full code example, mainF
, f4
, f
, f2
are all None. So for exmaple, you think you are passing a reference to mainF
frame as master to f4
, but in fact you are passing None
.