row + def packbox(parent)"row frames with fixed-width labelsfor color in colorsrow frame(parentlab label(rowtext=colorrelief=ridgewidth= ent entry(rowbg=colorrelief=sunkenwidth= row pack(side=toplab pack(side=leftent pack(side=rightent insert( 'pack'if __name__ ='__main__'root tk(gridbox(toplevel()packbox(toplevel()button(roottext='quit'command=root quitpack(mainloop(the pack version here uses row frames with fixed-width labels (againcolumn frames can skew rowsthe basic label and entry widgets are created the same way by these two functionsbut they are arranged in very different wayswith packwe use side options to attach labels and rows on the left and rightand create frame for each row (itself attached to the parent' current topwith gridwe instead assign each widget row and column position in the implied tabular grid of the parentusing options of the same name as we've learnedwith packthe packing order can mattertooa widget gets an entire side of the remaining space (mostly irrelevant here)and items packed first are clipped last (labels and topmost rows disappear last herethe grid alternative achieves the same clipping effect by virtue of grid behavior running the script makes the windows in figure - --one window for each scheme if you study this example closelyyou'll find that the difference in the amount of code required for each layout scheme is roughly washat least in this simple form the pack scheme must create frame per rowbut the grid scheme must keep track of the current row number in factboth schemes require the same number of code lines as shownthough to be fair we could shave one line from each by packing or gridding the label immediatelyand could shave two more lines from the grid layout by using the built-in enumerate function to avoid manual counting here' minimalist' version of the grid box function for referencedef gridbox(parent)for (rowcolorin enumerate(colors)label(parenttext=colorrelief=ridgewidth= grid(row=rowcolumn= ent entry(parentbg=colorrelief=sunkenwidth= grids