Raspberry Pi: 使用帧缓冲图像查看器 (FBI),有没有办法在不打开另一个 FBI 显示的情况下更改图像?

Raspberry Pi: Using framebuffer image viewer (FBI), is there a way to change an image without opening another FBI display?

所以,我有一个 TFT 屏幕和一个最多连接 4 个按钮的 Raspberry Pi。按下按钮时,与该按钮关联的图像将使用 fbi 显示在屏幕上。按照我写的方式,当按下一个按钮时,它会在旧的上面创建一个新的 fbi 显示。所以,我最终得到了一堆堆叠在一起的联邦调查局显示器。

有没有办法用新的替换当前的 fbi 显示,而不是创建一个叠加在旧的之上?

这是我的 python 代码:

import RPi.GPIO as GPIO
import os
import time

GPIO.setmode(GPIO.BCM)

GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP)  
GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_UP)  
GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP)  
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)


os.system("sudo fbi -T 2 -d /dev/fb1 -noverbose -a normal.png")

var = 1  
while var == 1:
  if (GPIO.input(23) == False):
    os.system("sudo fbi -T 2 -d /dev/fb1 -noverbose -a happy.png")

  if (GPIO.input(22) == False):
    os.system("sudo fbi -T 2 -d /dev/fb1 -noverbose -a sad.png")

  if (GPIO.input(27) == False):
    os.system("sudo fbi -T 2 -d /dev/fb1 -noverbose -a angry.png")

  if (GPIO.input(18) == False):
    os.system("sudo fbi -T 2 -d /dev/fb1 -noverbose -a surprised.png")

GPIO.cleanup()  

您可以在显示新图像之前终止进程。

....
 if (GPIO.input(23) == False):
    os.system("sudo killall -9 fbi")
    os.system("sudo fbi -T 2 -d /dev/fb1 -noverbose -a happy.png")

....