Python Curses 显示一个整数

问题描述

第一次发帖。我是一个编写python程序的新手。我想诅咒显示连接到 RaspBerry PI 的传感器的输出并创建以下代码作为测试,以了解需要以何种方式编码,但是我无法显示 cpu 温度?

import curses
from curses import wrapper
from gpiozero import cpuTemperature

print("Preparing to initialize screen...")

screen = curses.initscr()

print("Screen initialized.")

first_window = curses.newwin(15,20,0)

cpu = cpuTemperature()

print(int(cpu.temperature))

def main(test):

# Update the buffer,adding text at different locations
    first_window.addstr(1,1,"cpu Temperature")
    first_window.addch(2,int(cpu.temperature))
    first_window.refresh()
    curses.napms(5000)
    
wrapper(main)

curses.endwin()

print("Window ended.")

感谢阅读,感谢帮助

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)