跳转至

maliang.standard.texts

字数 441 个   代码 179 行   阅读时间 4 分钟   访问量

源代码:maliang/standard/texts.py

All standard Text classes

🟢Information

class public | Text

🟡append

method public

1
2
3
4
def append(
    self,
    text: str,
) -> None: ...
Append value to the value of Text

🟡clear

method public

1
2
3
def clear(
    self,
) -> None: ...
Clear the value of Text

🟡coords

method public

1
2
3
4
5
def coords(
    self,
    size: tuple[float, float] | None = None,
    position: tuple[float, float] | None = None,
) -> None: ...
Resize the Element

🟡delete

method public

1
2
3
4
def delete(
    self,
    num: int,
) -> None: ...
Remove a portion of the Text value from the trail

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...
Display the Element on a Canvas

🟡get

method public

1
2
3
def get(
    self,
) -> str: ...
Get the value of Text

🟡set

method public

1
2
3
4
def set(
    self,
    text: str,
) -> None: ...
Set the value of Text

🟢SingleLineText

class public | Text

def __init__(
    self,
    widget: virtual.Widget,
    relative_position: tuple[int, int] = (0, 0),
    size: tuple[int, int] | None = None,
    *,
    text: str = '',
    limit: int = 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,
) -> None: ...
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
  • 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

🟡_get_index

method protected

1
2
3
4
def _get_index(
    self,
    index: int,
) -> int: ...

🟡_get_margin

method protected

1
2
3
def _get_margin(
    self,
) -> float: ...
Get the size of the spacing between the text and the border

🟡_is_overflow

method protected

1
2
3
def _is_overflow(
    self,
) -> bool: ...
Whether the text content extends beyond the text box

🟡_move_left

method protected

1
2
3
def _move_left(
    self,
) -> None: ...
Move the text to the left as a whole, i.e. press the right arrow

🟡_move_right

method protected

1
2
3
def _move_right(
    self,
) -> None: ...
Move the text to the right as a whole, i.e. press the left arrow

🟡append

method public

1
2
3
4
def append(
    self,
    value: str,
) -> bool: ...
Add some characters to the text cursor

🟡clear

method public

1
2
3
def clear(
    self,
) -> None: ...
Clear

🟡coords

method public

1
2
3
4
5
def coords(
    self,
    size: tuple[float, float] | None = None,
    position: tuple[float, float] | None = None,
) -> None: ...
Resize the Element

🟡cursor_move

method public

1
2
3
4
def cursor_move(
    self,
    count: int,
) -> None: ...
Move the index position of the text cursor

🟡cursor_move_to

method public

1
2
3
4
def cursor_move_to(
    self,
    count: int,
) -> None: ...
Move the index position of the text cursor to a certain index

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...
Display the Element on a Canvas

🟡get

method public

1
2
3
def get(
    self,
) -> str: ...
Get text of the element

🟡insert

method public

1
2
3
4
5
def insert(
    self,
    index: int,
    value: str,
) -> bool: ...
Insert text to the location of the specified index

🟡pop

method public

1
2
3
4
def pop(
    self,
    index: int = -1,
) -> str: ...
Delete a character at the text cursor

🟡remove

method public

1
2
3
4
5
def remove(
    self,
    start: int,
    end: int | None = None,
) -> None: ...
Remove text within the specified index range

🟡set

method public

1
2
3
4
def set(
    self,
    value: str,
) -> bool: ...
Set text of the element

🟢_CanvasTextProxy

class protected | object

🟡__init__

method special

1
2
3
4
5
def __init__(
    self,
    canvas: containers.Canvas,
    tag_or_id: str | int,
) -> None: ...

🟡_get_index

method protected

1
2
3
4
def _get_index(
    self,
    index: int,
) -> int: ...

🟡append

method public

1
2
3
4
5
6
def append(
    self,
    value: str,
    *,
    show: str | None = None,
) -> None: ...
Append

🟡clear

method public

1
2
3
def clear(
    self,
) -> None: ...
Clear

🟡cursor_find

method public

1
2
3
4
def cursor_find(
    self,
    x: int,
) -> int: ...
cursor find

🟡cursor_get

method public

1
2
3
def cursor_get(
    self,
) -> int | None: ...
cursor get

🟡cursor_set

method public

1
2
3
4
def cursor_set(
    self,
    index: int,
) -> None: ...
cursor set

🟡get

method public

1
2
3
def get(
    self,
) -> str: ...
Get

🟡insert

method public

1
2
3
4
5
6
7
def insert(
    self,
    index: int,
    value: str,
    *,
    show: str | None = None,
) -> None: ...
Insert

🟡length

method public

1
2
3
def length(
    self,
) -> int: ...
Length

🟡pop

method public

1
2
3
4
def pop(
    self,
    index: int = -1,
) -> None: ...
Pop

🟡remove

method public

1
2
3
4
5
def remove(
    self,
    start: int,
    end: int | None = None,
) -> None: ...
Remove

🟡select_all

method public

1
2
3
def select_all(
    self,
) -> None: ...
select all

🟡select_clear

method public

1
2
3
def select_clear(
    self,
) -> None: ...
select clear

🟡select_get

method public

1
2
3
def select_get(
    self,
) -> tuple[int, int] | None: ...
select get

🟡select_set

method public

1
2
3
4
5
def select_set(
    self,
    start: int,
    end: int | None = None,
) -> None: ...
select set

🟡set

method public

1
2
3
4
5
6
def set(
    self,
    value: str,
    *,
    show: str | None = None,
) -> None: ...
Set