Skip to content

Commit

Permalink
version 1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaokang2022 committed Sep 16, 2024
1 parent ad351fd commit ae25989
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ Changelog / 更新日志
> * 🟠 **Deprecated / 弃用**
> * 🟤 **Refactored / 重构**
🔖 `1.0.5`
-----------

🕓 *Release Date / 发布日期 : 2024-09-16*

🟡 **Changed / 变更**

- The parameter `max_fps` of the class `VideoCanvas` has been changed to `interval`
`VideoCanvas` 的参数 `max_fps` 变更为 `interval`

🔵 **Optimized / 优化**

- Improved performance of `VideoCanvas`
改善 `VideoCanvas` 的性能

🔖 `1.0.4`
-----------

Expand Down
2 changes: 1 addition & 1 deletion tkintertools/media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@

from .main import *

__version__ = "1.0.4"
__version__ = "1.0.5"
__author__ = "Xiaokang2022 <2951256653@qq.com>"
10 changes: 6 additions & 4 deletions tkintertools/media/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(
| tkintertools.core.containers.Canvas",
*,
control: bool = False,
max_fps: int = 30,
interval: int = 10,
auto_play: bool = False,
click_pause: bool = True,
expand: typing.Literal["", "x", "y", "xy"] = "xy",
Expand All @@ -37,7 +37,9 @@ def __init__(
"""
* `master`: parent widget
* `control`: whether to enable the built-in UI
* `max_fps`: limitation of FPS
* `interval`: time interval(ms) at which frame information is queried,
the minimum requirement is 1, and too small may cause the window to lag
when dragging it
* `auto_play`: whether to start playing the video automatically
* `click_pause`: whether to pause when clicked
* `expand`: the mode of expand, `x` is horizontal, and `y` is vertical
Expand All @@ -50,7 +52,7 @@ def __init__(
tkintertools.core.containers.Canvas.__init__(
self, master, expand=expand, zoom_item=zoom_item,
keep_ratio=keep_ratio, free_anchor=free_anchor, name=name, **kwargs)
self.delay = 1000 // max_fps
self.interval = interval
self._control = control
self._auto_play = auto_play
self._video = self.create_image(0, 0, anchor="nw")
Expand Down Expand Up @@ -90,7 +92,7 @@ def _refresh(self) -> None:
elif val == 'eof' and self._control:
self.media.set_pause(True)
self.p.set(1)
self.schedule = self.after(self.delay, self._refresh)
self.schedule = self.after(self.interval, self._refresh)

def _tiem_convert(self, t: float) -> str:
"""Convert seconds to a special format"""
Expand Down

0 comments on commit ae25989

Please sign in to comment.