'Pygame only updating when input is detected

Pygame is not updating the screen until some sort of input is detected. It should update when a certain value equals a certain number, but only actually does this when a key is pressed. This happens with every key that is pressed, not just the ones that actually do something. Is there a way to have the screen update without needing the user to cause the update?

I have looked at a previous post but no answer was ever approved by the original poster, and none work for me anyway. Screen only updates when I check for user input pygame

I appreciate any help given :D

The code detecting the value:

    if distance <= 25 and display_scroll[1] <= -135 and display_scroll[1] >= -250:
        print("scroll from man:", display_scroll[1])
        doSpeechMan = True
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_e:
                doText = True
                print("interact")
                teacherTalk = True
    if distance >= 25 and display_scroll[1] >= -135 and display_scroll[1] <= -250:
        doText = False
        doSpeechMan = False

The code that should update the screen:

if doSpeechMan:
    
    display.blit(pygame.transform.scale(bubble_image, (72, 72)), (50-display_scroll[0], 75-display_scroll[1]))
    ptext.draw("Press E", (60-display_scroll[0], 90-display_scroll[1]), color="black", fontname="text/Pixel-y14Y.ttf", fontsize=10)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source