如何键入变量并将其作为普通文本读取?你知道吗
例如
small_font = pie game.Font.System_Font('a type of font', 25)
size = 'small'
text_surface = size_font.render(text, True, color)
如何让我的计算机将大小_font.render.....
读取为小_font.render.....
摘要
我在上面有这些
smallfont = pygame.font.SysFont('comicsansms', 25)
medimfont = pygame.font.SysFont('comicsansms', 50)
largefont = pygame.font.SysFont('comicsansms', 80)
我想要的是让我的电脑读取大小_字体.render..... 小的_字体.render..... 你知道吗
如果要根据字符串的值访问不同的变量/对象,标准解决方案是使用字典。例如:
编辑:也可以将字典键存储在变量中:
将函数用作模块的属性:
相关问题 更多 >
编程相关推荐