Skip to main content

playing video (with audio) in tkinter label

Project description

ttkvideo_player

ttkVideo_player: Python module for playing videos (with sound) inside tkinter Label widget using Pillow and imageio works best & fast on small size videos however takes few seconds of time for larger videos files Copyright © 2024 coder-wis vishalsharma.pypi@gmail.com

Built With :

  • tkinter & CustomTkinter (Python built-in)
  • imageio
  • Pillow

Installation:

The pip command to install ttkinter videos library for use

 pip install ttkvideo_player 
This will create a shim between your code and the module binaries that gets updated every time you change your code.  

Usage :

  • Import tkinter and tkvideo-moviepy
  • Create Tk() parent and the label you'd like to use
  • Get a moviepy video
  • Create ttkvideo_player object with its parameters(video_path, label_name,number of loops for the video if required and size of the video_screen)
  • Start the player thread with .play()
  • Start the Tk mainloop

Examples

The given below is an example of the 'demo.py' file to demonstrate the syntax :
  1. For Tkinter

      import ttkvideo
      import tkinter as tk
      win=tk.Tk()
      label=tk.Label(win)
      label.pack()
      player=ttkvideo_player.Ttkvideo( %video_path% ,label,loop=1,(640,400))
      player.play()
      win.mainloop()
    
  2. For Customtkinter

      import ttkvideo
      import customtkinter as ctk
      win=ctk.Tk()
      label=ctk.Label(win)
      label.pack()
      player=ttkvideo_player.Ttkvideo( %video_path% ,label,loop=1,(640,400))
      player.play()
      win.mainloop()
    

Releases :

For the updated version Latest version.

License

Distributed under the MIT License. See LICENSE for more information.

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

ttkvideo_player-0.0.2.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file ttkvideo_player-0.0.2.tar.gz.

File metadata

  • Download URL: ttkvideo_player-0.0.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for ttkvideo_player-0.0.2.tar.gz
Algorithm Hash digest
SHA256 388004743f51d1e8f987bacaddc1c069ea2b49ee1f24ead86649bdfb1c7e7f2f
MD5 46478bdbe18d6b230cd8b1a3c94b7f08
BLAKE2b-256 c131c2f12010c4dc79723b96b28bb89d542cee2d11cb45875408236697e0070e

See more details on using hashes here.

Supported by

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