I am getting familiar with the tkinter package/library. In my test program, I would like to
test the three different placement options using either pack, place, or grid. Using either
the place or the pack options seem to work just fine. However, when I attempt to use the
grid placement option, nothing happens for various values (row/column values). Does
anyone have an idea?
If I use the following line of code instead, then it appears to provide tangible results:
self.btn.grid(padx=110, pady=50)
The row=valuex, column=valuey appear to be irrelevant. What gives?
They market the ‘grid’ placement manager, as just that, a grid like placement
of widgets. Thus, you should be able to place widgets via an x and y pair.
The grid being the main window.
Can someone please provide an example for the grid manager using the row and column variables that provides a potential/working placement of the button widget for the example given above.
That is very nice.
Can you show one line of code for a particular static placement. Why does it not work for one line?
I have looked online for other examples. They all generally appear to show examples where more than one widget is being created … never just one. Here is an example that I pulled from the web:
No matter if I change the values of row and column, they never seem to move no further from
either row 1 or column 1 (starting from ‘0’). Apparently, ‘grid’ placement manager is not good for the placement of one button widget. It is only if you’re wanting on packing widgets closely together starting from left to right or top to bottom (diagonal as well).
The only one that gives you free reign placement with ease anywhere on a window is the place geometry manager. The pack GM is a bid rigid … you can only generally place a widget with the following restrictions: (center, y) or (x, center).
The following is the preferred way using the ‘place’ GM: