0
我通過lirc從遠程接收信號並將信號存儲在我使用的全局變量中。 我想保持這個全局變量不斷更新。 我想在後臺運行的功能如下:接收LIRC遠程控制信號,存儲並保持更新
def button_update():
while True:
global button
button = lirc.nextcode()
全局變量按鈕必須從我的程序的任何地方訪問。 我已經嘗試了線程,但它沒有工作。我的線程嘗試看起來是這樣的:
background_thread = Thread(target=button_update)
background_thread.daemon = True
background_thread.start()