Files
sunnypilot/system/ui/lib/label.py
Dean Lee ce7ff5c0e6 ui: Initial UI rewrite using pyray (spinner and text window) (#34583)
* pyray init version

* remove c++ code

* cleanup

* restruct the directory layout

* improve GuiApplication

* smooth out the texture after resize

* use atexit to close app

* rename FontSize->FontWeight

* make files executable

* use Inter Regular for FrontWeight.NORMAL

* set FLAG_VSYNC_HINT to avoid tearing while scrolling

* smoother scrolling

* mange textures in gui_app
2025-02-15 12:44:20 -08:00

14 lines
570 B
Python

import pyray as rl
from openpilot.system.ui.lib.utils import GuiStyleContext
def gui_label(rect, text, font_size):
styles = [
(rl.GuiControl.DEFAULT, rl.GuiDefaultProperty.TEXT_SIZE, font_size),
(rl.GuiControl.DEFAULT, rl.GuiDefaultProperty.TEXT_LINE_SPACING, font_size),
(rl.GuiControl.DEFAULT, rl.GuiDefaultProperty.TEXT_ALIGNMENT_VERTICAL, rl.GuiTextAlignmentVertical.TEXT_ALIGN_TOP),
(rl.GuiControl.DEFAULT, rl.GuiDefaultProperty.TEXT_WRAP_MODE, rl.GuiTextWrapMode.TEXT_WRAP_WORD)
]
with GuiStyleContext(styles):
rl.gui_label(rect, text)