python - python的帧缓冲模块

标签 python framebuffer

我正在寻找一个可以将 jpgpng 文件直接显示到 /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/

相关文章:

linux - Xorg 颜色显示错误

c++ - OpenGL:一次只能有一个 FBO 工作

c - 适用于 Linux 帧缓冲区的 Windows 镜像驱动程序

python - 按时差阈值匹配数据帧

python - tensorflow 卷积

python - 编写这个 for 循环的更有效方法?

python - 将 int 转换为固定字符数的字符串

python - Django 查找类型 ("iexact"、 "icontains"、 "month"等)在 Django nonrel 中不起作用(使用 dbindexer)

android - 原始数据来自/dev/graphics/fb0

c++ - opengl Framebuffer offscreen 到纹理,颜色错误