python播放视频

python播放视频

pip install pygame

  

import pygame

pygame.init()

# Set the dimensions of the window
screen = pygame.display.set_mode((640, 480))

# Load the video file
video = pygame.movie.Movie("1.mp4")

# Play the video
video.play()

# Wait for the video to finish
while video.get_busy():
    pygame.time.Clock().tick(30)

# Quit the program
pygame.quit()

  

 

 

 

 

###############

posted @ 2023-04-10 09:37  西北逍遥  阅读(56)  评论(0编辑  收藏  举报