TK.Anchor

TK.Anchor provides a single function translate_anchor which returns real x and y values from a relative positioning. For example positioning a TK.Window with anchor center needs to subtract half of its width from y and half of its height from x to appear at the correct position.

Source:

Methods

translate_anchor(anchoropt, x, y, width, height) → {object}

Returns real x and y values from a relative positioning.

Parameters:
Name Type Attributes Default Description
anchor string <optional>
"top-left"

Position of the anchor.

x number

X position to translate.

y number

Y position to translate.

width number

Width of the element.

height number

Height of the element.

Source:
Returns:

Object with members x and y as numbers

Type
object