better?
This commit is contained in:
parent
7f52894682
commit
132c6f09ba
@ -78,7 +78,7 @@ class ButtonTheme(BaseTheme):
|
||||
font_theme: Optional[FontTheme] = None,
|
||||
):
|
||||
super().__init__(main_color, secondary_color, main_font)
|
||||
self.font_theme = font_theme or FontTheme(main_color, secondary_color, main_font)
|
||||
self.font_theme = font_theme or FontTheme()
|
||||
self.hit_color = hit_color
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ class PressTextButton(widgets.WidgetBase):
|
||||
batch=self.front_batch, group=self.front_group,
|
||||
x=self._x, y=self._y, width=self._width,
|
||||
height=self._height,)
|
||||
self.font = pyglet.font.load(self.font_theme.main_font,
|
||||
self.font = pyglet.font.load(self.font_theme.main_font,
|
||||
self.font_theme.font_size,
|
||||
bold=self.font_theme.font_bold,
|
||||
italic=self.font_theme.font_italic,
|
||||
@ -178,10 +178,10 @@ class PressTextButton(widgets.WidgetBase):
|
||||
...
|
||||
|
||||
def on_press(self, x, y):
|
||||
import random
|
||||
# import random
|
||||
self.value += "1"
|
||||
next_rgb = [random.randint(50, 255) for _ in range(3)]
|
||||
self.untouched_color = (*next_rgb, 255)
|
||||
# next_rgb = [random.randint(50, 255) for _ in range(3)]
|
||||
# self.untouched_color = (*next_rgb, 255)
|
||||
|
||||
|
||||
PressTextButton.register_event_type('on_press')
|
||||
|
@ -95,8 +95,7 @@ class SR1ShipRender(BaseScreen):
|
||||
x=main_window.width / 2, y=main_window.height / 2)
|
||||
self.render_d_label.visible = self.status.draw_d_pos
|
||||
|
||||
self.test_button = PressTextButton(x=100, y=100,
|
||||
width=150, height=30, text='test button',
|
||||
self.test_button = PressTextButton(x=100, y=100, width=150, height=30, text='test button',
|
||||
batch=self.main_batch, group=Group(5, parent=main_window.main_group))
|
||||
# self.test_button.push_handlers(main_window)
|
||||
main_window.push_handlers(self.test_button)
|
||||
|
Loading…
Reference in New Issue
Block a user