我的Python线程启动但不执行任何操作已修复

我正在使用自定义基本功能来简化代码,例如wait(seconds)或msg(...),现在我正在进行窗口设置和更新,它可以工作,但是当我把它在一个线程中,它什么也不会做。我没有任何错误,所以我感到困惑和沮丧。我不需要您调试它或任何东西,我只需要帮助才能知道问题出在哪里以及为什么会出问题。我刚开始使用python。到目前为止,这是我的脚本(脚本在底部):

#   Imports
if True:
    import pygame,math,random,time,sys,threading
    from pygame.locals import *
    pygame.init()


#   Setup
if True:
    win_n = "New Project"
    win_w = 800
    win_h = 600
    win_c = (0,0)

#   Code
if True:
    def wait(seconds):
        time.sleep(seconds)
    def wait_until(bool):
        while not bool:
            wait(0.001)

#   Execute
if True:
    def e_ws():
        mainClock = pygame.time.Clock()
        pygame.display.set_caption(win_n)
        monitor_size = [pygame.display.Info().current_w,pygame.display.Info().current_h]
        screen = pygame.display.set_mode((win_w,win_h),pygame.RESIZABLE)
        fullscreen = False
        while True:
            screen.fill(win_c)
            for event in pygame.event.get():
                if event.type == QUIT:
                    pygame.quit()
                    sys.exit()
                if event.type == VIDEORESIZE:
                    if not fullscreen:
                        screen = pygame.display.set_mode((event.w,event.h),pygame.RESIZABLE)
                if event.type == KEYDOWN:
                        if fullscreen:
                            screen = pygame.display.set_mode(monitor_size,pygame.FULLSCREEN)
                        else:
                            screen = pygame.display.set_mode((screen.get_width(),screen.get_height()),pygame.RESIZABLE)
            pygame.display.update()
            mainClock.tick(60)
    t_ws = threading.Thread(target=e_ws)
    t_ws.start()
    print("done")

相关文章

功能概要:(目前已实现功能)公共展示部分:1.网站首页展示...
大体上把Python中的数据类型分为如下几类: Number(数字) ...
开发之前第一步,就是构造整个的项目结构。这就好比作一幅画...
源码编译方式安装Apache首先下载Apache源码压缩包,地址为ht...
前面说完了此项目的创建及数据模型设计的过程。如果未看过,...
python中常用的写爬虫的库有urllib2、requests,对于大多数比...