kivy对raspery pi的werid行为导致屏幕空白

时间:2016-12-21 13:22:55

标签: python raspberry-pi kivy raspberry-pi3

我得到了一个带有主要GUI线程和RFID线程的kivy应用程序(一个守护程序线程,它从设备读取并将作业放到Queue())。由查询Queue()的时钟设置的调度间隔用于任何传入作业。 GUI在后台有一个图像,只要在队列中找到作业,所有窗口小部件都被清除,图像被添加到窗口小部件,然后在两秒后被清除,循环继续。

class MainScreen(Screen):
    background = BACKGROUND
    def __init__(self):
        super(MainScreen, self).__init__()
        # Checking for cart input 30 times per second
        self.event = Clock.schedule_interval(self.listen_for_cart_input, EVENT_INTERVAL_RATE)
        self.add_widget(Image(source=self.background))

    def listen_for_cart_input(self, dt):
        try:
            code = carts.get(timeout=QUEUE_TIMEOUT)
            Clock.unschedule(self.event)
            # Do Something 
            self.handle_transition()
        except (Empty, AssertionError):
            pass
    def handle_transition(self):
        trigger_back_to_main = Clock.create_trigger(self.back_to_main, timeout=TRANSITION_TIMEOUT)
        self.clear_widgets()
        self.add_widget(Image(source=image))
        trigger_back_to_main()

    def back_to_main(self, dt):
        self.clear_widgets()
        self.add_widget(Image(source=self.background))
        self.event = Clock.schedule_interval(self.listen_for_cart_input, EVENT_INTERVAL_RATE)

插入一张卡后,每天几次(卡片插入每天发生约100次)完美无缺,屏幕变为空白,引发以下异常。请注意,只有屏幕变为空白且应用程序正常运行。插入卡片多次后,屏幕再次显示图像。

这是一个错误吗? 我无法弄清楚提出的行为的原因

[WARNING           ] stderr: Exception in thread Thread-3:
[WARNING           ] stderr:   File "/usr/local/lib/python3.5/threading.py", line 914, in _bootstrap_inner
[WARNING           ] stderr:     self.run()
[WARNING           ] stderr:   File "/usr/local/lib/python3.5/threading.py", line 862, in run
[WARNING           ] stderr:     self._target(*self._args, **self._kwargs)
[WARNING           ] stderr:   File "/usr/local/lib/python3.5/site-packages/kivy/input/providers/hidinput.py", line 687, in _thread_run
[WARNING           ] stderr:     data = fd.read(struct_input_event_sz)
[WARNING           ] stderr: OSError: [Errno 19] No such device

1 个答案:

答案 0 :(得分:0)

问题与将树莓派连接到液晶显示器的HDMI线缆有关。我通过更换电缆来修理它。