1

First time posting. I'm a novice writing a python program. I'd like to to curses to display outputs from sensors connected to a Raspberry PI and created the follow code as a test to understand what way it would need to be coded, however i can't get the CPU temp to be display?

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, 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, 1, int(cpu.temperature))
    first_window.refresh()
    curses.napms(5000)
    
wrapper(main)

curses.endwin()

print("Window ended.")

Thanks for reading, help appreciated

Foiloutboy
  • 11
  • 1

0 Answers0