Python Pygame口袋妖怪风格的文本显示
我已经看过一些教程,其中一个是在pygame窗口中延迟放置文本,使其看起来就像是在口袋妖怪游戏中一样。然而,我很难直接将其插入窗口,而不是将其插入“矩形”形状。程序不会显示任何错误,运行正常,但文本也不会显示在屏幕上Python Pygame口袋妖怪风格的文本显示,python,pygame,Python,Pygame,我已经看过一些教程,其中一个是在pygame窗口中延迟放置文本,使其看起来就像是在口袋妖怪游戏中一样。然而,我很难直接将其插入窗口,而不是将其插入“矩形”形状。程序不会显示任何错误,运行正常,但文本也不会显示在屏幕上 def display_text_animation(string): #Here is the function for animating the text text = '' for i in range(len(string)): text += string[
def display_text_animation(string): #Here is the function for animating the text
text = ''
for i in range(len(string)):
text += string[i]
text_surface = font.render(text, True, BLACK)
pygame.display.update()
pygame.time.wait(100)
def intro():
gameDisplay = displayBox()
progBg1 = pygame.image.load("introScr.png")
gameDisplay.blit(progBg1, (0,0))
display_text_animation('Hello World!') #here is where I call the text to appear.
调用
font.render
,它将返回存储在text\u Surface
变量中的Surface
但是您不需要使用这个新的
曲面
。在调用pygame.display.update()
调用font.render
之前,必须将其快速放到显示器Surface
上,这将返回存储在text\u Surface
变量中的Surface
但是您不需要使用这个新的
曲面
。在调用pygame.display.update()
之前,您必须将其快速放到显示器Surface
上?我看不到您在任何地方引用文本。@Jerome Indefenzo抱歉,我忘了添加渲染线。我的坏蛋。。。现在可以了吗?到底是哪一部分在渲染文本?我看不到您在任何地方引用文本。@Jerome Indefenzo抱歉,我忘了添加渲染线。我的坏蛋。。。现在能用了吗?抱歉,我该怎么做呢?感谢您对@slothApologies的帮助,但我该怎么做呢?谢谢你的帮助@sloth