You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
500 B
15 lines
500 B
2 months ago
|
|
||
|
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)
|