File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 1313from arcade .resources import resolve
1414from arcade .texture_atlas import TextureAtlasBase
1515from arcade .types import Color , Point , RGBOrA255
16+ from arcade .types .rect import LRBT , Rect
1617
1718__all__ = ["load_font" , "Text" , "create_text_sprite" , "draw_text" ]
1819
@@ -578,6 +579,18 @@ def bottom(self) -> float:
578579 """Pixel location of the bottom content border."""
579580 return self .label .bottom
580581
582+ @property
583+ def rect (self ) -> Rect :
584+ """Rect representing the bounds of the text.
585+
586+ .. tip:: Don't worry about `width` being `None`.
587+
588+ Although a label can be created with a `width=None`:
589+ * The underlying :py:mod:`pyglet` label will have bounding dimensions
590+ * This rect is for on-screen click and layout purposes, not maximum possible width
591+ """
592+ return LRBT (self .left , self .right , self .bottom , self .top )
593+
581594 @property
582595 def content_size (self ) -> tuple [int , int ]:
583596 """Get the pixel width and height of the text contents."""
You can’t perform that action at this time.
0 commit comments