From 114f3c6e6af07a0d85dfeaf1c741e5d07a82c722 Mon Sep 17 00:00:00 2001 From: shenjack-5600u <3695888@qq.com> Date: Sat, 27 Jul 2024 03:31:54 +0800 Subject: [PATCH] property --- Difficult_Rocket/gui/widget/button.py | 32 +++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/Difficult_Rocket/gui/widget/button.py b/Difficult_Rocket/gui/widget/button.py index 636cb3f4..1f9a9c38 100644 --- a/Difficult_Rocket/gui/widget/button.py +++ b/Difficult_Rocket/gui/widget/button.py @@ -131,8 +131,8 @@ def _create_vertex_list(self) -> None: self._num_verts, self._draw_mode, groups, - self._batch, # pyright: ignore reportArgumentType - self._group, # pyright: ignore reportArgumentType + self._batch, # pyright: ignore reportArgumentType + self._group, # pyright: ignore reportArgumentType position=("f", self._get_vertices()), colors=("Bn", self._rgba * self._num_verts), translation=("f", (self._x, self._y) * self._num_verts), @@ -146,6 +146,34 @@ def thick1(self) -> float: def thick2(self) -> float: return self.thick2 + @property + def width(self) -> float: + return self._width + + @property + def height(self) -> float: + return self.height + + @thick1.setter + def thick1(self, value: float): + self._thick1 = value + self._update_vertices() + + @thick2.setter + def thick2(self, value: float): + self._thick2 = value + self._update_vertices() + + @width.setter + def width(self, value: float): + self._width = value + self._update_vertices() + + @height.setter + def height(self, value: float): + self._height = value + self._update_vertices() + class BaseButtonTheme: """