Python Pygame-有没有办法从fontType.render获取字符串?

Python Pygame-有没有办法从fontType.render获取字符串?,python,text,dialog,pygame,Python,Text,Dialog,Pygame,我正在试着一个字母一个字母地打印对话框中的对话(如口袋妖怪或大多数RPG),我想知道是否有办法从fontType.render变量中获取字符串,如下所示: self.Coffee = self.fontType.render("Ooh! French Vanilla!", 0, (0,0,0,)) 我试着做: self.Coffee[0] …但我得到: TypeError: 'pygame.Surface' object has no attribute '__getitem__' 我试图

我正在试着一个字母一个字母地打印对话框中的对话(如口袋妖怪或大多数RPG),我想知道是否有办法从fontType.render变量中获取字符串,如下所示:

self.Coffee = self.fontType.render("Ooh! French Vanilla!", 0, (0,0,0,))
我试着做:

self.Coffee[0]
…但我得到:

TypeError: 'pygame.Surface' object has no attribute '__getitem__'
我试图避免像这样为字符串创建一个变量(尽管它可能会工作,但对于我处理其余代码的方式来说,它似乎太草率或太混乱):

如果不让我知道,我希望我说得够清楚。谢谢。

建议对象本质上是一块画布,您的文本将绘制在画布上。一旦你把文本放在上面,它就是文本的一个图像,所以一旦画出来,就没有任何实际的方法来检索它(不是不可能,只是不切实际)。我会按照你的建议,将对话文本存储在一个变量中。不管怎样,当我在屏幕上发布任何形式的提示或消息时,我都倾向于这样做。我宁愿看到这个:

dialogue = 'Ooh! French Vanilla!'
self.Coffee = self.fontType.render(dialogue, 0, (0,0,0))
除此之外:

self.Coffee = self.fontType.render('Some really long dialogue that might make me want this on two lines', 0, (0,0,0))

谢谢你的解释。在对代码进行了一些修改之后,我试图避免的方式实际上并没有那么糟糕。
self.Coffee = self.fontType.render('Some really long dialogue that might make me want this on two lines', 0, (0,0,0))