奇怪的Pygame Python图像出现故障

奇怪的Pygame Python图像出现故障,python,image,pygame,Python,Image,Pygame,我不知道为什么当按下按钮时,它不会进入下一个功能。它又回到了另一个,真的很奇怪,很烦人。 它应该转到whattodo函数,但它会运行半秒钟,然后转到另一个函数。有人知道为什么吗 #!/usr/bin/python import pygame pygame.init() screen = pygame.display.set_mode((1400,700)) pygame.display.set_caption("Anti-Docter") titlescreen = pygame.image.l

我不知道为什么当按下按钮时,它不会进入下一个功能。它又回到了另一个,真的很奇怪,很烦人。 它应该转到whattodo函数,但它会运行半秒钟,然后转到另一个函数。有人知道为什么吗

#!/usr/bin/python
import pygame
pygame.init()
screen = pygame.display.set_mode((1400,700))
pygame.display.set_caption("Anti-Docter")
titlescreen = pygame.image.load('titleframe.bmp')
boxinfo = pygame.image.load('boxinfo.bmp')
black = (0,0,0)
white = (255,255,255)
randommommycolor = (255,139,12)
Brown = (102,51,0)
Lighter_Brown = (120,59,5)
def mts(text, textcolor, x, y, fs):
    font = pygame.font.Font(None,fs)
    text = font.render(text, True, textcolor)
    screen.blit(text, [x,y])
def buttonPlay(x,y,w,h,ic,ac):
    mouse = pygame.mouse.get_pos()
    click = pygame.mouse.get_pressed()

    if x+w > mouse[0] > x and y+h > mouse[1] > y:
        pygame.draw.rect(screen, ac,(x,y,w,h))

        if click[0] == 1:
            whattodo()
    else:
        pygame.draw.rect(screen, ic,(x,y,w,h))
def whattodo():
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            quit()
    screen.blit(boxinfo, (0,0))
    pygame.display.update()

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            quit()
    screen.blit(titlescreen, (0,0))
    buttonPlay(580, 350, 200, 90, Brown, Lighter_Brown)
    mts("Play", black, 620, 365, 80)
    pygame.display.update()

每次主循环重复时,它都会调用“buttonPlay”。“whattodo”中没有任何东西可以改变这种行为,因此“whattodo”运行一次,然后控制流传回主循环,主循环只重复“buttonPlay”