Skip to main content

A widget that displays GIFs in Tkinter

Project description

A widget that displays GIFs in Tkinter.
一个能在Tkinter中显示GIF动图的控件。

介绍文章:https://www.bilibili.com/read/cv31300353/
导入方式: from TkGifWidget import *或import TkGifWidget

缺陷: 因为Tk的图像加载方式,极少部分透明度不规则的GIF动图加载速度会极慢。

2024/7/14更新:

  1. AnimatedGif类新增play_end_func形参,以便在动图播放结束时回调处理。感谢B站@只是一个球_提出的建议
  2. 以下改动(未全部列出)使控件可以修改动图,也可以在指定动图前先创建控件:
    • AnimatedGif类file_path, play_mode形参变为默认值形参。
    • 设置动图的部分移至set_gif()方法。
    • bg_img属性只读,且值类型变为Image对象而非PhotoImage。
    • 使用bg_imgtk只读属性获取PhotoImage对象。
    • 新增set_bg_img()方法用于设置当前背景图。(若想指定默认背景图请修改default_bg属性)
    • 处理背景图部分移至apply_bg_func()方法。
    • 新增set_play_mode()方法用于设置播放模式。
    • AnimatedGif类bg_path属性名称修改为default_bg(即使这样不符合向下兼容)。 default_bg用于指定默认的背景图,值可以是路径或Image对象。
  3. 修复调用end_play()后,在小于duration时间内再调用start_play()会使播放速度加倍的BUG。
  4. 修改内部图像容器的borderwidth为0以确保无边框。
  5. AnimatedGif类新增nogif_bg形参,用于指定没有动图时的背景图。

2024/7/28更新:

  • 修复动图在播放时透明颜色不能正确显示的BUG。感谢B站@只是一个球_
  • 添加帧持续时间缺失时的处理。

2025/2/21更新:

  • Add English translation of the module's documentation string. 为模块中的文档字符串添加英文翻译。
  • Adding the module to PyPI and GitHub. 将该模块添加到PyPI和Github上。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tkgifwidget-0.0.3.tar.gz (8.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tkgifwidget-0.0.3-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

TkGifWidget-0.0.3-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file tkgifwidget-0.0.3.tar.gz.

File metadata

  • Download URL: tkgifwidget-0.0.3.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for tkgifwidget-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f2cec9c1b2ff258dc35b726d37cb90b1b35b470390f5e99169101d46f3a53db5
MD5 d9fe382dfcea38e0e9f6a8ac05a851df
BLAKE2b-256 acb58c2b04699d8937713c65751296bfd96758d6179837adab794c70e99528b4

See more details on using hashes here.

File details

Details for the file tkgifwidget-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: tkgifwidget-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tkgifwidget-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6d074869f5a4d8d6b8152d57a1cc32d783d8051e79bfc070c499d7f82328c70b
MD5 3d6f80a798f79101e8270ebb9969ea88
BLAKE2b-256 b78d84f4a398bb2546f21ab58e4cf6084604b07cbd5f031be52559913d9d46ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for tkgifwidget-0.0.3-py3-none-any.whl:

Publisher: publish.yml on JellyfisHawthorn/TkGifWidget

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file TkGifWidget-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: TkGifWidget-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for TkGifWidget-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3a9d1df7a726ec1e76696b8ba8c6710dbee6016f4c971f15bb96e1e3756cbd87
MD5 d3a1c7498423e2b151aba63584b7efc6
BLAKE2b-256 47694506c6812055b33712fbdd0d400876e59c6548b24981cc2b8cfa24913785

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page