我正在寻找一个可以将 jpg
或 png
文件直接显示到 /dev/fb0
的 python 模块。
我希望模块可以这样调用并在屏幕上显示图片:
show_photo(path_to_jpg, x, y, dev='/dev/fb0')
我在谷歌上搜索了几天这样的python模块,我找到了链接:[Module] Python Frame Buffer , 但找不到该网站。
现在,我正在使用 C 程序并通过 os.system()
函数调用,它太慢了。有没有直接把图片显示到frame buffer,支持静态图片,跑马灯的python模块?如果模块也支持播放视频文件,比如mplayer
就更好了。
最佳答案
也许你可以使用pygame。
http://www.pygame.org/wiki/about
Pygame uses either opengl, directx, windib, X11, linux frame buffer, and many other different backends...
更新: 简单示例:
import pygame
import sys
import time
pygame.init()
size = (pygame.display.Info().current_w, pygame.display.Info().current_h)
black = 0, 0, 0
screen = pygame.display.set_mode(size)
ball = pygame.image.load("ball.gif")
ballrect = ball.get_rect()
screen.fill(black)
screen.blit(ball, ballrect)
pygame.display.flip()
time.sleep(5)
运行:
SDL_NOMOUSE=1 python ./ball.py
关于python - python的帧缓冲模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11608454/