Kivy ui在RPI上非常慢

时间:2018-09-28 10:34:52

标签: python python-3.x kivy raspberry-pi3 raspbian

我使用带有Raspbian Stretch Desktop的Pi 3 Model B +。我已经用kivy ui在python3中编写了一个应用程序。稍后,该应用程序将在rpi触摸屏上运行。但是,奇异果非常慢。当我按下微调器时,它需要3秒钟才能反应。

按照此处的建议Raspberry Pi Python (Kivy) extremely slow with sudo,我添加了

  import os
  os.environ['KIVY_WINDOW'] = 'egl_rpi'

但这没有帮助。

如何加快猕猴桃的速度?还是rpi不能更快地渲染kivy?

这是我的config.ini

[kivy]
keyboard_repeat_delay = 300
keyboard_repeat_rate = 30
log_dir = logs
log_enable = 1
log_level = info
log_name = kivy_%y-%m-%d_%_.txt
window_icon = 
keyboard_mode = 
keyboard_layout = qwerty
desktop = 1
exit_on_escape = 1
pause_on_minimize = 0
kivy_clock = default
default_font = ['Roboto', 'data/fonts/Roboto-Regular.ttf', 'data/fonts/Roboto-Italic.ttf', 'data/fonts/Roboto-Bold.ttf', 'data/fonts/Roboto-BoldItalic.ttf']
log_maxfiles = 100
window_shape = data/images/defaultshape.png
config_version = 20

[graphics]
display = -1
fullscreen = 0
height = 600
left = 0
maxfps = 60
multisamples = 2
position = auto
rotation = 0
show_cursor = 1
top = 0
width = 800
resizable = 1
borderless = 0
window_state = visible
minimum_width = 0
minimum_height = 0
min_state_time = .035
allow_screensaver = 1
shaped = 0

[input]
mouse = mouse
%(name)s = probesysfs,provider=hidinput

[postproc]
double_tap_distance = 20
double_tap_time = 250
ignore = []
jitter_distance = 0
jitter_ignore_devices = mouse,mactouch,
retain_distance = 50
retain_time = 0
triple_tap_distance = 20
triple_tap_time = 375

[widgets]
scroll_timeout = 250
scroll_distance = 20
scroll_friction = 1.
scroll_stoptime = 300
scroll_moves = 5

[modules]

1 个答案:

答案 0 :(得分:0)

有很多原因会导致您的应用运行缓慢,但是首先,请检查它是否对所有应用都通用,或者是否是您特定的。为此,我鼓励您尝试一个简单的应用程序。

from kivy.app import App
from kivy.uix.button import Button

class TestApp(App):
    def build(self):
        return Button(text='test')

TestApp().run()

按下此按钮是否缓慢?如果是这样,我鼓励您总体上看一下kivy配置,也许尝试在配置中将多重采样设置为0或1,检查日志中是否使用了正确的窗口提供程序,等等。

如果性能不错,请尝试简化您的应用程序,直到性能再次达到理想水平为止,您可以启用监视器模块以轻松检查帧速率,并使调试器模块(需要烧瓶)监视内存使用情况。几乎不可能对这个问题给出一个一般性的答案,因此可能需要更多的细节,大概是在您进一步缩小问题范围之后。