Skip to main content

playing video (with audio) in tkinter label

Project description

ttkvideos

tkVideo: 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 © 2023 vishal sharma &nbsp Sharma659615@gmail.com

Built With :

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

Installation:

The pip command to install ttkinter videos library for use

 pip install ttkvideos 
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 tkvideo 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 ttkvideos
      import tkinter as tk
      win=tk.Tk()
      label=tk.Label(win)
      label.pack()
      player=ttkvideos.Ttkvideos( %video_path% ,label,loop=1,(640,400))
      player.play()
      win.mainloop()
    
  2. For Customtkinter

      import ttkvideos
      import customtkinter as ctk
      win=ctk.Tk()
      label=ctk.Label(win)
      label.pack()
      player=ttkvideos.Ttkvideos( %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

ttkvideos-0.0.4.tar.gz (4.6 kB view hashes)

Uploaded Source

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