Difficult-Rocket/Difficult_Rocket/gui/widget/theme/button.py

50 lines
1.2 KiB
Python
Raw Normal View History

# -------------------------------
# Difficult Rocket
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
# All rights reserved
# -------------------------------
from typing import Optional, Tuple
from pyglet.shapes import Rectangle
from pyglet.graphics import Batch, Group
from Difficult_Rocket.gui.widget.theme import BaseTheme, FontTheme
_RGBA = Tuple[int, int, int, int]
class ButtonBaseTheme(BaseTheme):
"""
Base theme of button
inherit from BaseTheme and dict
按钮的基础主题
继承了 BaseTheme dict
"""
theme_name = 'Button Base Theme'
def init(self, batch: Batch, group: Group, **kwargs) -> None:
"""
Init theme
:param batch: batch
:param group: group
:param kwargs: options
:return: None
"""
self.batch = batch
self.group = group
self.font_theme = FontTheme(**kwargs)
class BlockTheme(ButtonBaseTheme):
"""
button theme: Block like button
"""
theme_name = 'Block Theme(button)'
main_color: _RGBA = (39, 73, 114, 255)
touch_color: _RGBA = (66, 150, 250, 255)
hit_color: _RGBA = (15, 135, 250, 255)
font_theme: FontTheme = FontTheme()