【发布时间】:2019-08-06 05:27:48
【问题描述】:
当文本的长度超过窗口宽度或超过我限制的长度时,我想打印到新行。 "\n" 在这里不起作用,因为我正在使用一个函数来塑造文本消息。
示例:
input_message = "Hello, world!"
message = text_format(input_message, font, 90, yellow)
# Text Renderer
def text_format(message, textFont, textSize, textColor):
newFont=pygame.font.Font(textFont, textSize)
newText=newFont.render(message, 0, textColor)
return newText
我希望 input_message 会打印如下:
“你好,”
“世界!” (“世界!”超过窗口宽度)。
如何修改text_format函数来实现?
【问题讨论】:
标签: python css python-3.x python-2.7 pygame