我在更新文本框时收到以下错误:
load glyph failed err=23 face=0x0, glyph=19
负责更新文本框的所有行看起来都像par:
self.lnePer1_temp.setText(str(values_s[0]))# + " °C")
聚合这些方法的方法如下所示:
def timer_handler(self):
self.pressedSearchDevices()
if self.grbKeys1.isEnabled():
self.pressedKey1_bat()
if self.grbKeys2.isEnabled():
self.pressedKey2_bat()
if self.grbPer1.isEnabled():
self.pressedPer1_read_all()
if self.grbPer2.isEnabled():
self.pressedPer2_read_all()
threading.Timer(60, lambda: self.timer_handler()).start()
基本上它会定期检查某些设备是否可用并相应地更新文本框。当评论出来时 - 一切正常。负责更新文本框的完整方法是:
def pressedPer2_read_all(self):
call('./reset_ble.sh', shell=True)
cmd = "sudo node Per_read_all.js " + Per_2.lower()
output = 'None'
with Popen(cmd, shell=True, stdout=PIPE, preexec_fn=os.setsid) as process:
try:
output = process.communicate(timeout=5)[0]
except TimeoutExpired:
os.killpg(process.pid, signal.SIGINT) # send signal to the process group
output = process.communicate()[0]
print(output)
output_s = output.decode("utf-8")
values_s = output_s.split('\n')
for s in values_s: print(s + " °C")
if len(values_s) == 7:
self.lnePer2_temp.setText(str(values_s[0]))# + " °C")
self.lnePer2_dig.setText(str(values_s[1]))
self.lnePer2_light.setText(str(values_s[2]))# + " %")
self.lnePer2_hum.setText(str(values_s[3]))# + " %")
self.lnePer2_alert.setText(str(values_s[4]))
self.lnePer2_but.setText(str(values_s[5]))
else:
self.lnePer2_temp.setText(" °C")
self.lnePer2_dig.setText(" ")
self.lnePer2_light.setText(" %")
self.lnePer2_hum.setText(" %")
self.lnePer2_alert.setText(" ")
self.lnePer2_but.setText(" ")
当仅用if-else
语句替换else
语句时 - 一切正常,所以我假设错误在于值的更改或类似的事情。类似的错误消息链接到Qt,所以我也假设故障位于那里。
脚本在Raspberry Pi Zero上运行,使用的Python版本是Python 3.4.2,PyQt5版本是5.3.2。