亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我的 Python 線程啟動但沒有執行任何操作

我的 Python 線程啟動但沒有執行任何操作

繁花如伊 2023-05-23 16:25:52
我正在研究自定義基本功能以簡化我的編碼,例如 wait(seconds) 或 msg(...),現在我正在研究窗口設置和更新,它可以工作,但是當我把它放在線程,它不會做任何事情。我沒有收到任何錯誤,所以我感到困惑和沮喪。我不需要你調試它或任何東西,我只需要幫助知道問題出在哪里以及為什么會出現問題。到目前為止,這是我的腳本(腳本在底部):#   Importsif True:    import pygame, math, random, time, sys, threading    from pygame.locals import *    pygame.init()#   Setupif True:    win_n = "New Project"    win_w = 800    win_h = 600    win_c = (0, 0, 0)#   Codeif True:    def wait(seconds):        time.sleep(seconds)    def wait_until(bool):        while not bool:            wait(0.001)#   Executeif 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 回答

?
哈士奇WWW

TA貢獻1799條經驗 獲得超6個贊

python yourscriptname.py從命令行運行腳本。



查看完整回答
反對 回復 2023-05-23
  • 1 回答
  • 0 關注
  • 190 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號