maliang.standard.texts¶
字数 9 个 阅读时间不到 1 分钟 访问量
All standard Text
classes
类:
-
Information
–General information text
-
SingleLineText
–Single-line editable text
Information ¶
Information(
widget: Widget,
relative_position: tuple[int, int] = (0, 0),
size: tuple[int, int] | None = None,
*,
text: str = "",
limit: int = -1,
show: str | None = None,
placeholder: str = "",
family: str | None = None,
fontsize: int | None = None,
weight: typing.Literal["normal", "bold"] = "normal",
slant: typing.Literal["roman", "italic"] = "roman",
underline: bool = False,
overstrike: bool = False,
name: str | None = None,
gradient_animation: bool = True,
**kwargs
)
General information text
方法:
SingleLineText ¶
SingleLineText(
widget: virtual.Widget,
relative_position: tuple[int, int] = (0, 0),
size: tuple[int, int] | None = None,
*,
text: str = "",
ignore: tuple[str, ...] = ("\n", "\r"),
limit: int = math.inf,
limit_width: int = 0,
show: str | None = None,
placeholder: str = "",
align: typing.Literal["left", "center", "right"] = "left",
family: str | None = None,
fontsize: int | None = None,
weight: typing.Literal["normal", "bold"] = "normal",
slant: typing.Literal["roman", "italic"] = "roman",
underline: bool = False,
overstrike: bool = False,
name: str | None = None,
gradient_animation: bool = True,
**kwargs
)
Single-line editable text
widget
: parent widgetrelative_position
: position relative to its widgetssize
: size of elementtext
: text valuefamily
: font familyfontsize
: font sizeweight
: weight of the fontslant
: slant of the fontunderline
: wether text is underlineoverstrike
: wether text is overstrikealign
: align mode of the textignore
: ignore the input of some characterslimit
: limit on the number of characterslimit_width
: limit on the width of charactersshow
: display a value that obscures the original contentplaceholder
: a placeholder for the promptname
: name of elementgradient_animation
: Wether use animation to change colorkwargs
: extra parameters for CanvasItem
方法:
-
display
–Display the
Element
on aCanvas
-
coords
–Resize the
Element
-
get
–Get text of the element
-
set
–Set text of the element
-
insert
–Insert text to the location of the specified index
-
append
–Add some characters to the text cursor
-
remove
–Remove text within the specified index range
-
pop
–Delete a character at the text cursor
-
clear
–Clear
-
cursor_move
–Move the index position of the text cursor
-
cursor_move_to
–Move the index position of the text cursor to a certain index