Raspberry Pi 2 B Tkinter performance problem

165 views Asked by At

I am trying to write a simple python program for a Rasperry Pi 2 Model B. When finished it should be able to get a few values via uart and display one out of 200 images based on that. Additionally, it will show a video and a few static images. For that, I use Tkinter and Tkvideo. But now I run in to serious performance problems. I thought this is a simple Project and would work. But the Raspberry has trouble, even if I only start VS Code on it, and the text input has a delay of over a second.

As OS, I use (Debian version: 11 (bullseye)), the python version is 3.9

I reduced the Code, so it only opens a window and plays the one video: Even if I only show the video, it renders in ca. 1-2 fps.

from tkinter import *
from tkvideo import tkvideo
from PIL import Image, ImageTk

class App():
    def __init__(self):
       self.timeStartMS = int(round(time.time() * 1000))

       self.root = Tk()
       self.root.geometry("1280x800")

       label3 = Label(self.root, width=200, height=800, borderwidth=2, relief="groove")
       label3.place(x=420,y=0)
       label3v = Label(label3)
       label3v.place(x=200,y=100)

       player = tkvideo("Video/testVideo.mp4", label3v ,loop=1)
       player.play()
       self.root.after(self.msPerFrame, self.update)
    
       self.root.mainloop()

app = App()

Is a Raspberry Pi 2 B simply not strong enough for this, or what else could I do to make it work? Thanks in advance.

0

There are 0 answers