This is an unofficial mirror of Tkinter reference documentation (based on Python 2.7 and Tk 8.5) created by the late John Shipman.
It was last updated in 2013 and is unmaintained. [More info]
These grid-related methods are defined on all widgets:
w
.grid_bbox(column=None, row=None,
col2=None, row2=None)
Returns a 4-tuple describing the bounding box of
some or all of the grid system in widget
.
The first two numbers returned are the w
x
and y
coordinates of the upper left corner of the area,
and the second two numbers are the width and
height.
If you pass in column
and row
arguments, the returned bounding box
describes the area of the cell at that column and
row. If you also pass in col2
and
row2
arguments, the returned
bounding box describes the area of the grid from
columns column
to col2
inclusive, and from rows row
to
row2
inclusive.
For example,
returns the bounding box of four cells,
not one.
w
.grid_bbox(0, 0, 1,
1)
w
.grid_forget()
This method makes widget
disappear from the screen. It still exists, it
just isn't visible. You can use w
.grid()
it to make it appear again, but it
won't remember its grid options.
w
.grid_info()
Returns a dictionary whose keys are w
's option
names, with the corresponding values of those
options.
w
.grid_location(x
,
y
)
Given a coordinates (
relative to the containing widget, this
method returns a tuple x
, y
)(
describing what cell of col
, row
)
's grid
system contains that screen coordinate.
w
w
.grid_propagate()
Normally, all widgets
propagate their dimensions,
meaning that they adjust to fit the contents.
However, sometimes you want to force a widget to be
a certain size, regardless of the size of its
contents. To do this, call
where
w
.grid_propagate(0)
is the widget whose size you want to
force.
w
w
.grid_remove()
This method is like
.grid_forget()
, but its grid
options are remembered, so if you
.grid()
it again, it will
use the same grid configuration options.
w
.grid_size()
Returns a 2-tuple containing the number of columns
and the number of rows, respectively, in
's
grid system.
w
w
.grid_slaves(row=None, column=None)
Returns a list of the widgets managed by widget
. If no arguments are provided, you will get
a list of all the managed widgets. Use the w
row=
argument to select only the widgets
in one row, or the column=
argument
to select only the widgets in one column.