python3 tkinter grid and pack, inline packing syntax & elegance python3 tkinter grid and pack, inline packing syntax & elegance tkinter tkinter

python3 tkinter grid and pack, inline packing syntax & elegance


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.