Draw text on top of the screen with optional interaction tracking (press/move/hold). Setter names such as text/background are methods; read current values through state().
Syntax
OverlayText(text="", position=(0, 0), color="#FFFFFFFF", size=16, background=None)Constructor parameters
| Name | Description |
|---|---|
textString | Initial text content. Optional · Positional or named Default: "" |
positionPoint | tuple[Number, Number] | Optional · Positional or named Default: (0, 0) |
colorColor | String | Number | Initial text color. Optional · Positional or named Default: white |
sizeNumber | Initial text size (sp). Optional · Positional or named Default: 16 |
backgroundColor | String | Number | None | Initial background color. None means transparent/no background. Optional · Positional or named Default: None |
Returns
Example
badge = OverlayText("Running...", Point(320, 160, scale="width", anchor="top"), background=None)
badge.color("#FF00E676").background("#66000000").size(18).track(press=True, move=True, hold=True, hold_ms=700)
badge.show()
state = badge.state()
if state["status"] == 2:
MacroPanel.notify("Badge is moving")
p = badge.get_point()
r = badge.get_region()
if r is not None:
r.highlight("yellow", auto_hide_ms=600)
badge.hide() # hide fast
badge.show() # show again quickly
badge.off() # fully releaseFields
| Name | Description |
|---|---|
xNumber | Top-left X position in pixels. Writable before show(). Default: 0 |
yNumber | Top-left Y position in pixels. Writable before show(). Default: 0 |
scaleString | Coordinate scale copied from Point positions. Default: fixed |
anchorString | Coordinate anchor copied from Point positions. Default: none |
argbColor | Text color. Assign with Color/string/number values. Use overlay.color(value) for method chaining. Default: white |
size_spNumber | Text size in sp. Use overlay.size(sp) for method chaining. Default: 16 |
badge = OverlayText("Ready", Point(420, 220, scale="width", anchor="top"), background=None)