0% found this document useful (0 votes)
106 views2 pages

Tkinter Anchors PDF

Anchors define how text is positioned relative to a reference point using constants like NW, N, NE, W, CENTER, E, SW, S, and SE. CENTER centers text horizontally and vertically, while NW positions text with the reference point at the top left corner. The anchor option controls whether elements are placed at edges or centered within frames.

Uploaded by

sri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views2 pages

Tkinter Anchors PDF

Anchors define how text is positioned relative to a reference point using constants like NW, N, NE, W, CENTER, E, SW, S, and SE. CENTER centers text horizontally and vertically, while NW positions text with the reference point at the top left corner. The anchor option controls whether elements are placed at edges or centered within frames.

Uploaded by

sri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Advertisements

Previous Page Next Page

Anchors are used to define where text is positioned relative to a reference point.

Here is list of possible constants, which can be used for Anchor attribute.

NW

NE

CENTER

SW

SE

For example, if you use CENTER as a text anchor, the text will be centered
horizontally and vertically around the reference point.

Anchor NW will position the text so that the reference point coincides with the
northwest (top left) corner of the box containing the text.

Anchor W will center the text vertically around the reference point, with the left
edge of the text box passing through that point, and so on.
If you create a small widget inside a large frame and use the anchor=SE option,
the widget will be placed in the bottom right corner of the frame. If you used
anchor=N instead, the widget would be centered along the top edge.

The anchor constants are shown in this diagram −

Previous Page Next Page

Advertisements

You might also like