mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-24 18:42:07 +08:00
ce7ff5c0e6
* 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
15 lines
500 B
Python
15 lines
500 B
Python
|
|
import pyray as rl
|
|
from openpilot.system.ui.lib.utils import GuiStyleContext
|
|
|
|
BUTTON_DEFAULT_BG_COLOR = rl.Color(51, 51, 51, 255)
|
|
|
|
def gui_button(rect, text, bg_color=BUTTON_DEFAULT_BG_COLOR):
|
|
styles = [
|
|
(rl.GuiControl.DEFAULT, rl.GuiDefaultProperty.TEXT_ALIGNMENT_VERTICAL, rl.GuiTextAlignmentVertical.TEXT_ALIGN_MIDDLE),
|
|
(rl.GuiControl.DEFAULT, rl.GuiControlProperty.BASE_COLOR_NORMAL, rl.color_to_int(bg_color))
|
|
]
|
|
|
|
with GuiStyleContext(styles):
|
|
return rl.gui_button(rect, text)
|