Python 为什么我的空闲窗口一直没有响应?

Python 为什么我的空闲窗口一直没有响应?,python,python-3.x,windows,pygame,Python,Python 3.x,Windows,Pygame,当我拒绝时,有没有人不想玩它 我希望它询问用户是否有人不想玩,并将其从列表中删除,然后询问是否还有其他人。在我希望它加载游戏之后 import pygame from pygame import * import random import time import sys pygame.init() Red = (247, 12, 12) White = (255,255,255) Blue = (0, 157, 255) Black=(0,0,0) Person_One = random.ra

当我拒绝时,有没有人不想玩它 我希望它询问用户是否有人不想玩,并将其从列表中删除,然后询问是否还有其他人。在我希望它加载游戏之后

import pygame
from pygame import *
import random
import time
import sys
pygame.init()
Red = (247, 12, 12)
White = (255,255,255)
Blue = (0, 157, 255)
Black=(0,0,0)
Person_One = random.randint(0,19)
Person_Two = random.randint(0,19)
Number1 = random.randint(0,100)
Number2 = random.randint(0,100)
Number1 = random.randint(0,100)
Number2 = random.randint(0,100)
mmm =  ["Donald", "Jacey","Baxter","Dusan","Nathaniel","Hayden","Yusuf","Hayley","Andre","Rafif","Jeremey","Mark","Tia","Malu","Dorian","Jarius","Sammar","Peter","Rafif","Jasmin"]

Playerone = mmm[Person_One]
Playertwo = mmm[Person_Two]
X = 1400
timer = 0
Y = 1000
noonbe = input("Does anyone not want to play?\n")
noonbe.lower()
if noonbe == 'yes':
    thenwho = input("Who is it?\n")
    mmm.remove(thenwho)
    noonbe = input("Does anyone else not want to play?\n")
    noonbe.lower()
    if noonbe == 'yes':
        thenwho = input("Who is it?\n")
        mmm.remove(thenwho)
        noonbe = input("Does anyone else not want to play?\n")
        noonbe.lower()
    if noonbe == 'no':
        pass

    
display_surface = pygame.display.set_mode((X, Y))
font = pygame.font.Font('freesansbold.ttf', 20)
text = font.render("Player one is:", True, Black, White)
textRect = text.get_rect()
textRect.center = (X // 4.4, Y // 3.6)
text1 = font.render(Playerone, True, Black, White)
text1Rect = text1.get_rect()
text1Rect.center = (X // 4.4, Y // 3)
text2 = font.render("Player two is:", True, Black, White)
text2Rect = text2.get_rect()
text2Rect.center = (X // 1.5, Y // 3.6)
text3 = font.render(Playertwo, True, Black, White)
text3Rect = text3.get_rect()
text3Rect.center = (X // 1.5, Y // 3)
aa = True
while True:
    
    # completely fill the surface object
    # with white color
    display_surface.fill(White)
 
    # copying the text surface object
    # to the display surface object
    # at the center coordinate.
    display_surface.blit(text, textRect)
    display_surface.blit(text1, text1Rect)
    display_surface.blit(text2, text2Rect)
    display_surface.blit(text3, text3Rect)
    aa = False
    Number2=str(Number2)
    text3 = font.render(Number2, True, Black, White)
    text3Rect = text3.get_rect()
    text3Rect.center = (X // 1.5, Y // 3)
    pygame.display.update()
    time.sleep(20)
    font = pygame.font.Font('freesansbold.ttf', 20)
    text2 = font.render("Player two's number is:", True, Black, White)
    text2Rect = text2.get_rect()
    text2Rect.center = (X // 1.5, Y // 3.6)
    Number1 = str(Number1)
    text1 = font.render(Number1, True, Black, White)
    text1Rect = text1.get_rect()
    text1Rect.center = (X // 4.4, Y // 3)
    font = pygame.font.Font('freesansbold.ttf', 20)
    text = font.render("Player one's number is:", True, Black, White)
    textRect = text.get_rect()
    textRect.center = (X // 4.4, Y // 3.6)
    display_surface.blit(text, textRect)
    display_surface.blit(text1, text1Rect)
    display_surface.blit(text2, text2Rect)
    display_surface.blit(text3, text3Rect)    
甚至在我没有添加sys.exit()时也发生了这种情况
我不知道为什么这样的事情会发生在我身上,我知道把东西放在哪里,但不知何故需要去其他地方

如果你
sleep()
程序将暂停。你应该考虑使用一个额外的线程来做基于时间的工作。但是它没有反应,不得不强迫它关闭任务管理器,这就是我所说的“暂停”。在处理UI的线程上长时间睡眠是不可能的。那么段代码应该是什么样子呢?@KlausD。那么代码部分的意思是什么呢?