Layout widgets are used to handle layouts for the Tk application. Frame widget is used group other widgets and place, pack, and grid are layout manager to give you total control over your adding to windows. The list of available layout widgets are as shown below −
|Sr.No.||Widgets & Description|
Container widget to hold other widgets.
Widget to hold other widgets in specific place with coordinates of its origin and an exact size.
Simple widget to organize widgets in blocks before placing them in the parent widget.
Widget to nest widgets packing in different directions.
A simple Tk example is shown below for layout widgets −
#!/usr/bin/wish frame .myFrame1 -background red -relief ridge -borderwidth 8 -padx 10 -pady 10 -height 100 -width 100 frame .myFrame2 -background blue -relief ridge -borderwidth 8 -padx 10 -pady 10 -height 100 -width 50 pack .myFrame1 pack .myFrame2
When we run the above program, we will get the following output −