I wish to update a text label when I key press down but nothing happens. It probably have something to do with the loop but I am not sure how to fix it.
I am using pygame
import pygame
pygame.init()
display_width = 800
display_height = 600
screen = pygame.display.set_mode((display_width, display_height))
done = False
pygame.display.set_caption('UTTER')
bg = pygame.image.load("wheel.bmp")
digitalFont = pygame.font.Font("digital-7.ttf",26)
mixValue = "03"
def updateLED (dial, value):
if dial == "mix":
mixLED = digitalFont.render(value, 1, (255,255,0))
screen.blit(mixLED, (362, 166))
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_DOWN:
updateLED("mix", "01")
print("down")
# Add this somewhere after the event pumping and before the display.flip()
screen.blit(bg, (0, 0))
updateLED ("mix", "03")
pygame.display.update()
pygame.quit()
quit()