TKinter Tutorial
About Lesson

In this TKinter Tutorial we are going to learn creating TKinter Layout, so as i have already said that there are different layouts that you can use in tkinter. for example we have pack, grid and place. The place layout positions widgets using absolute positioning. The pack layout organizes widgets in horizontal and vertical boxes. The grid layout places widgets in a two dimensional grid.



So now let’s create an example, in the first we want to create pack layout, using pack we can align the widgets horizontally and vertically.



You can see that we have used different versions of pack, using pack you can expand the widget, you can align the widget to the left or to the right.



If you run the code this will be the result.

TKinter Tutorial - TKinter Layout
TKinter Tutorial – TKinter Layout




Now let’s create grid layout, we can use grid layout for aligning widget in row and column. you can use grid for this, in the grid we need to give the column and row number.





Run the code and this will be the result.

TKinter Grid
TKinter Grid





Now let’s use place, using place we can manage our widgets in the x and y position, you can use absolute position or relative position.