其实也没啥
This commit is contained in:
parent
a6abdeefb5
commit
2a0d95eb84
@ -11,11 +11,14 @@ github: @shenjackyuanjie
|
||||
gitee: @shenjackyuanjie
|
||||
"""
|
||||
|
||||
from ..api import translate
|
||||
from Difficult_Rocket import translate
|
||||
|
||||
from libs import pyglet
|
||||
from libs.pyglet import font
|
||||
from libs.pyglet.text import Label
|
||||
from libs.pyglet.gui import widgets
|
||||
from libs.pyglet.sprite import Sprite
|
||||
from libs.pyglet.shapes import Rectangle
|
||||
from libs.pyglet.graphics import Batch, Group
|
||||
from libs.pyglet.image import AbstractImage
|
||||
|
||||
@ -50,17 +53,48 @@ class InputBox(widgets.WidgetBase):
|
||||
y: int,
|
||||
width: int,
|
||||
height: int,
|
||||
batch: Batch,
|
||||
group: Group,
|
||||
message: str = ''):
|
||||
message: str = '',
|
||||
font_name: str = translate.鸿蒙简体,
|
||||
font_size: int = 15,
|
||||
text_color: [int, int, int] = (0, 0, 0, 255),
|
||||
out_line_color: [int, int, int] = (255, 255, 255),
|
||||
|
||||
out_line: int = 2,
|
||||
batch: Batch = Batch(),
|
||||
group: Group = Group()):
|
||||
super().__init__(x, y, width, height)
|
||||
self._text = message
|
||||
self.text = self._text
|
||||
self.字体 = font.load(font_name, font_size)
|
||||
self.字高 = self.字体.ascent - self.字体.descent
|
||||
self.外框距离 = out_line
|
||||
self._输入框 = Label(x=x + out_line, y=y + out_line,
|
||||
width=width, height=height,
|
||||
font_name=font_name, font_size=font_size,
|
||||
batch=batch, group=group,
|
||||
text=message)
|
||||
self._外框 = Rectangle(x=x-out_line, y=y-out_line,
|
||||
width=width + (out_line * 2), height=height + (out_line * 2),
|
||||
batch=batch, group=group)
|
||||
self._光标 = Rectangle(x=x+out_line, y=y+out_line,
|
||||
width=1, height=self.字高,
|
||||
batch=batch, group=group)
|
||||
|
||||
@property
|
||||
def text(self):
|
||||
return self._text
|
||||
|
||||
@text.setter
|
||||
def text(self, value):
|
||||
assert type(value) is str, 'Input Box\'s text must be string!'
|
||||
self._text = value
|
||||
self._输入框.text = value
|
||||
|
||||
@property
|
||||
def value(self):
|
||||
return self.enabled
|
||||
return self.text
|
||||
|
||||
def _update_position(self):
|
||||
pass
|
||||
|
||||
a = InputBox(1, 2, 3, 4, 5, 6, 7)
|
||||
|
||||
self._输入框.position = self._x + self.外框距离, self._y + self.外框距离
|
||||
self._外框.position = self._x - self.外框距离, self._y - self.外框距离
|
||||
self._光标.position = self._x + self.外框距离, self._y + self.外框距离
|
||||
|
@ -31,7 +31,7 @@
|
||||
- `Develop platform 1 - Windows 10`
|
||||
- `Python 3.8.10`
|
||||
- `Windows10 x64`
|
||||
- `pyglet 2.0.dev9`
|
||||
- `pyglet 2.0.dev11`
|
||||
- `Json5 0.9.6`
|
||||
- `pillow 8.1.0`
|
||||
- `AMD R5 5600X`
|
||||
@ -48,8 +48,7 @@
|
||||
## Required python modules
|
||||
|
||||
- json5 (pre-installed V0.9.6 path:`./libs/json5`)
|
||||
|
||||
[comment]: <> (- pyglet (pre-installed V2.0.dev9 path:`./libs/pyglet`))
|
||||
- pyglet (pre-installed V2.0.dev11 path:`./libs/pyglet`)
|
||||
- pillow
|
||||
- semver
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
- `开发平台1 Windows 10`
|
||||
- `Python 3.8.10`
|
||||
- `Windows10 x64`
|
||||
- `pyglet 2.0.dev9`
|
||||
- `pyglet 2.0.dev11`
|
||||
- `Json5 0.9.6`
|
||||
- `pillow 8.1.0`
|
||||
- `AMD R5 5600X(AMD YES!)`
|
||||
@ -49,7 +49,7 @@
|
||||
## 需要的Python模块
|
||||
|
||||
- json5 (已经内置V0.9.6 路径:`./libs/json5`)
|
||||
- pyglet (已经内置V2.0.dev9 路径:`./libs/pyglet`)
|
||||
- pyglet (已经内置V2.0.dev11 路径:`./libs/pyglet`)
|
||||
- pillow
|
||||
- semver
|
||||
|
||||
|
@ -16,6 +16,11 @@
|
||||
|
||||
- now command will fade away but not suddenly disappear
|
||||
|
||||
### Add
|
||||
|
||||
- `gui/widgets.py` InputBox
|
||||
- making
|
||||
|
||||
## 20211025 V 0.6.0
|
||||
|
||||
#### Command Line Update!
|
||||
|
BIN
tests/SR make/随便什么的贴图.png
Normal file
BIN
tests/SR make/随便什么的贴图.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Loading…
Reference in New Issue
Block a user