0
我得到了一個帶有主GUI線程和RFID線程的kivy應用程序(一個從設備讀取並將作業放到Queue()
的守護程序線程)。查詢隊列()的時鐘由任何傳入作業設置。 GUI在後臺有一個圖像,無論何時在隊列中找到作業,所有小部件都被清除,圖像被添加到小部件,然後在兩秒後清除,循環繼續。插入卡後kivy在raspery pi上的行爲導致屏幕變白
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倍),屏幕變爲空白籌集以下異常。請注意,只有屏幕變黑並且應用程序運行正常。插入卡多次後,屏幕會再次顯示圖像。
它是一個錯誤? 我不能找出所述凸起execption
[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