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()