跳转至

maliang.standard.texts

字数 9 个   阅读时间不到 1 分钟   访问量

源代码:maliang/standard/texts.py

All standard Text classes

类:

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
)

Bases: virtual.Text

General information text

方法:

  • display

    Display the Element on a Canvas

  • coords

    Resize the Element

  • get

    Get the value of Text

  • set

    Set the value of Text

  • append

    Append value to the value of Text

  • delete

    Remove a portion of the Text value from the trail

  • clear

    Clear the value of Text

display

display() -> None

Display the Element on a Canvas

coords

coords(
    size: tuple[float, float] | None = None, position: tuple[float, float] | None = None
) -> None

Resize the Element

get

get() -> str

Get the value of Text

set

set(text: str) -> None

Set the value of Text

append

append(text: str) -> None

Append value to the value of Text

delete

delete(num: int) -> None

Remove a portion of the Text value from the trail

clear

clear() -> None

Clear the value of 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
)

Bases: virtual.Text

Single-line editable text

  • widget: parent widget
  • relative_position: position relative to its widgets
  • size: size of element
  • text: text value
  • family: font family
  • fontsize: font size
  • weight: weight of the font
  • slant: slant of the font
  • underline: wether text is underline
  • overstrike: wether text is overstrike
  • align: align mode of the text
  • ignore: ignore the input of some characters
  • limit: limit on the number of characters
  • limit_width: limit on the width of characters
  • show: display a value that obscures the original content
  • placeholder: a placeholder for the prompt
  • name: name of element
  • gradient_animation: Wether use animation to change color
  • kwargs: extra parameters for CanvasItem

方法:

  • display

    Display the Element on a Canvas

  • 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

display

display() -> None

Display the Element on a Canvas

coords

coords(
    size: tuple[float, float] | None = None, position: tuple[float, float] | None = None
) -> None

Resize the Element

get

get() -> str

Get text of the element

set

set(value: str) -> bool

Set text of the element

insert

insert(index: int, value: str) -> bool

Insert text to the location of the specified index

append

append(value: str) -> bool

Add some characters to the text cursor

remove

remove(start: int, end: int | None = None) -> None

Remove text within the specified index range

pop

pop(index: int = -1) -> str

Delete a character at the text cursor

clear

clear() -> None

Clear

cursor_move

cursor_move(count: int) -> None

Move the index position of the text cursor

cursor_move_to

cursor_move_to(count: int) -> None

Move the index position of the text cursor to a certain index