python的帧缓冲模块 [英] Frame buffer module of python
问题描述
我正在寻找一个可以直接将jpg
或png
文件显示到/dev/fb0
的python模块.
I'm looking for a python module which can display jpg
or png
file to /dev/fb0
directly.
我希望模块可以像这样调用并在屏幕上显示图片:
I hope the the module can call and display the picture on screen by like this:
show_photo(path_to_jpg, x, y, dev='/dev/fb0')
我已经在Google上搜索了这种python模块几天,然后找到了链接:
I had searched such kind of python module on google for several days, and I found the link: [Module] Python Frame Buffer, but the website was not found.
现在,我正在使用C程序并通过os.system()
函数进行调用,它太慢了.是否有一个python模块可以将图片直接显示到帧缓冲区,并支持静态图片,字幕?如果模块还支持播放mplayer
之类的视频文件会更好.
Now, I'm using C program and call by os.system()
function, and it is too slow. Does there has a python module which can show the picture directly to frame buffer, and support static picture, marquee? It will be better if the module also support playing video file like mplayer
.
推荐答案
也许您可以使用pygame.
Maybe you may use pygame.
http://www.pygame.org/wiki/about
Pygame使用opengl,directx,windib,X11, Linux帧缓冲区, 以及许多其他不同的后端...
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的帧缓冲模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!