跳转至

tkintertools.media.main

字数 259 个   代码 75 行   阅读时间 2 分钟   访问量

APIs for playing videos

🟢VideoCanvas

class public | Canvas

def __init__(
    self,
    master: containers.Tk | containers.Canvas,
    *,
    controls: bool = False,
    loop: bool = False,
    click_pause: bool = True,
    expand: typing.Literal['', 'x', 'y', 'xy'] = 'xy',
    zoom_item: bool = False,
    keep_ratio: typing.Optional[typing.Literal['min', 'max']] = None,
    free_anchor: bool = False,
    name: str = 'Canvas',
    **kwargs,
) -> None: ...
A canvas that is scalable and playable for videos

  • master: parent widget
  • controls: whether to enable the built-in UI
  • loop: whether the video loops automatically
  • click_pause: whether to pause when clicked
  • expand: the mode of expand, x is horizontal, and y is vertical
  • zoom_item: whether or not to scale its items
  • keep_ratio: the mode of aspect ratio, min follows the minimum value, max follows the maximum value
  • free_anchor: whether the anchor point is free-floating
  • kwargs: compatible with other parameters of class tkinter.Canvas

🟡_display_control_bar

method protected

1
2
3
4
def _display_control_bar(
    self,
    value: bool,
) -> None: ...
Animation for bottom bar

🟡_initialization

method protected

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

🟡_load_control_bar

method protected

1
2
3
def _load_control_bar(
    self,
) -> None: ...
UI for bottom bar

🟡_play

method protected

1
2
3
4
def _play(
    self,
    init_prams: dict[str, bool] | None = None,
) -> None: ...
Refresh the canvas

🟡_re_place

method protected

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

🟡_refresh_control_bar

method protected

1
2
3
4
def _refresh_control_bar(
    self,
    pts: float,
) -> None: ...
Refresh the stat of the control bar

🟡_resize

method protected

1
2
3
def _resize(
    self,
) -> None: ...
Resize the size of video

🟡close

method public

1
2
3
def close(
    self,
) -> None: ...
Close the video player

🟡open

method public

1
2
3
4
5
6
7
def open(
    self,
    file: str,
    *,
    auto_play: bool = False,
    muted: bool = False,
) -> None: ...

Open a video file and play

  • file: the video file path
  • auto_play: whether to start playing the video automatically
  • muted: whether or not to mute the video at the start

🟢_AudioImage

class protected | Image _CustomizedWidget

1
2
3
4
5
def __init__(
    self,
    *args,
    **kwargs,
) -> None: ...
Customized image widget for displaying audio icon

🟢_CustomizedWidget

class protected | Widget ABC

🟡_bind

method protected

1
2
3
4
5
def _bind(
    self,
    *,
    icon: str,
) -> None: ...
process some thing about theme

🟡_theme

method protected

1
2
3
4
def _theme(
    self,
    dark: bool,
) -> None: ...
Switch the icon theme of the widget

🟢_FullscreenToggleButton

class protected | ToggleButton _CustomizedWidget

1
2
3
4
5
def __init__(
    self,
    *args,
    **kwargs,
) -> None: ...
Customized toggle button for function of fullscreen

🟢_PlayButton

class protected | Button _CustomizedWidget

1
2
3
4
5
def __init__(
    self,
    *args,
    **kwargs,
) -> None: ...
Customized Button for the ability to play or pause the video

🟡_toggle

method protected

1
2
3
def _toggle(
    self,
) -> None: ...
Force to change the icon image