How to fix “Text has zero width” error in python when using screen.blit

感情迁移 提交于 2019-12-11 17:39:00

问题


I'm making the google dinosaur game in python and i have multithreaded the scoring system. The multi-threading works but pygame keeps popping up an error that says "Text has zero width"

def scoreCounter(currentScore, block1, block2, delay):
    while(True):
        currentScore += 1
        scoreText = scoreFont.render("Score {0}".format(currentScore), 1, (0, 0, 0))
        screen.blit(scoreText, (1, 1))
        pygame.time.wait(delay)
        #delay is changed based on the current score, default is 100
        #rest of the code is just evaluating whether or not the score has reached a certain point

block1 and block2 are references to the two block that appear as obstacles
The result is that it's supposed to update the score. Keeps popping up the same error.

来源:https://stackoverflow.com/questions/54282062/how-to-fix-text-has-zero-width-error-in-python-when-using-screen-blit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!