跳转至

tkintertools.standard.texts

字数 468 个   代码 145 行   阅读时间 3 分钟   访问量

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: ...

🟡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: ...

🟡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: Widget,
    relative_position: tuple[int, int] = (0, 0),
    size: tuple[int, int] | None = None,
    *,
    text: str = '',
    limit: int = inf,
    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,
    animation: bool = True,
    styles: dict[str, dict[str, str]] | None = None,
    **kwargs,
) -> None: ...
Single-line editable text

  • widget: parent widget
  • relative_position: position relative to its widgets
  • size: size of component
  • 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
  • show: display a value that obscures the original content
  • placeholder: a placeholder for the prompt
  • name: name of component
  • animation: Wether use animation to change color
  • styles: style dict of component
  • kwargs: extra parameters for CanvasItem

🟡_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

🟡_text_delete

method protected

1
2
3
4
5
def _text_delete(
    self,
    start: int,
    end: typing.Union[int, typing.Literal['end']],
) -> None: ...
Delete the actual text that appears on the component

🟡_text_get

method protected

1
2
3
def _text_get(
    self,
) -> str: ...
Get the actual text that appears on the component

🟡_text_insert

method protected

1
2
3
4
5
def _text_insert(
    self,
    index: int,
    value: str,
) -> None: ...
Insert the actual text that appears on the component

🟡_text_length

method protected

1
2
3
def _text_length(
    self,
) -> int: ...
Get the length of actual text that appears on the component

🟡_text_overflow

method protected

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

🟡_text_set

method protected

1
2
3
4
def _text_set(
    self,
    value: str,
) -> None: ...
Set the actual text that appears on the component

🟡append

method public

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

🟡coords

method public

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

🟡cursor_find

method public

1
2
3
4
def cursor_find(
    self,
    x: int,
) -> int: ...
Return the index of text with the x position of mouse

🟡cursor_get

method public

1
2
3
def cursor_get(
    self,
) -> int: ...
Get the index position of the text cursor

🟡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

🟡cursor_set

method public

1
2
3
4
def cursor_set(
    self,
    index: int,
) -> int: ...
Set the index position of the text cursor

🟡delete

method public

1
2
3
4
5
def delete(
    self,
    start: int,
    end: int,
) -> None: ...
Delete text within the specified index range, [start, end]

🟡display

method public

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

🟡get

method public

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

🟡get_gap

method public

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

🟡insert

method public

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

🟡pop

method public

1
2
3
def pop(
    self,
) -> None: ...
Delete a character at the text cursor

🟡select_all

method public

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

🟡select_clear

method public

1
2
3
def select_clear(
    self,
) -> None: ...
Clear the selected text

🟡select_get

method public

1
2
3
def select_get(
    self,
) -> tuple[int, int] | None: ...
Get the index tuple of the selected text

🟡select_set

method public

1
2
3
4
5
def select_set(
    self,
    start: int,
    end: int,
) -> None: ...
Set the index tuple of the selected text, [start, end]

🟡set

method public

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