跳转至

maliang.media.main

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

源代码:maliang/media/main.py

APIs for playing videos

🟢VideoCanvas

class public | Canvas

def __init__(
    self,
    master: containers.Tk | containers.Toplevel | containers.Canvas | None = None,
    *,
    controls: bool = False,
    loop: bool = False,
    click_pause: bool = True,
    expand: typing.Literal['', 'x', 'y', 'xy'] = 'xy',
    auto_zoom: bool = False,
    keep_ratio: typing.Literal['min', 'max'] | None = None,
    free_anchor: bool = False,
    **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
  • auto_zoom: 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

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

🟡destroy

method public

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

🟡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

🟡zoom

method public

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

🟢_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,
    theme: typing.Literal['light', 'dark'],
) -> 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