Skip to content

Instantly share code, notes, and snippets.

@irudnyts
Created December 6, 2023 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irudnyts/244b93bc317f67cca71d69d96e5f365a to your computer and use it in GitHub Desktop.
Save irudnyts/244b93bc317f67cca71d69d96e5f365a to your computer and use it in GitHub Desktop.
import pygame
from gpiozero import CPUTemperature
pygame.init()
clock = pygame.time.Clock()
screen = pygame.display.set_mode([400, 400])
font = pygame.font.SysFont(None, 400)
cpu = CPUTemperature()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
temp = str(round(cpu.temperature))
screen.fill((0, 0, 0))
screen.blit(font.render(temp, True, (255, 255, 255)), (0, 0))
pygame.display.flip()
clock.tick(8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment