Difficult-Rocket/Difficult_Rocket/guis/widgets.py

67 lines
1.4 KiB
Python
Raw Normal View History

2021-10-01 23:12:01 +08:00
# -------------------------------
# Difficult Rocket
# Copyright © 2021 by shenjackyuanjie
# All rights reserved
# -------------------------------
"""
writen by shenjackyuanjie
mail: 3695888@qq.com
github: @shenjackyuanjie
gitee: @shenjackyuanjie
"""
2021-10-23 17:01:59 +08:00
from ..api import translate
2021-10-01 23:12:01 +08:00
from libs import pyglet
from libs.pyglet.gui import widgets
from libs.pyglet.sprite import Sprite
2021-11-04 22:35:09 +08:00
from libs.pyglet.graphics import Batch, Group
2021-10-01 23:12:01 +08:00
from libs.pyglet.image import AbstractImage
__all__ = ['Parts']
2021-10-01 23:12:01 +08:00
class Parts(widgets.WidgetBase):
"""
parts
"""
2021-10-01 23:12:01 +08:00
def __init__(self,
x: int,
y: int,
width: int,
height: int,
textures: AbstractImage,
batch: Batch,
parts_data: dict):
super().__init__(x, y, width, height)
self.sprite = Sprite(img=textures, x=x, y=y, batch=batch)
self._value = 0
2021-11-04 22:35:09 +08:00
class InputBox(widgets.WidgetBase):
"""
input box
"""
def __init__(self,
x: int,
y: int,
width: int,
height: int,
batch: Batch,
group: Group,
message: str = ''):
super().__init__(x, y, width, height)
@property
def value(self):
return self.enabled
def _update_position(self):
pass
a = InputBox(1, 2, 3, 4, 5, 6, 7)