首页 > 解决方案 > 为什么我会收到此 PEP 警告?

问题描述

我在我的 Pygame 中得到了这些鼓舞人心的警告:

Expected type 'bool', got 'int' instead

它们都与这样的变量相关,我为我的文本定义字体等:

welcome = welcome_font.render("Welcome to mosquito hunt! ", 1, (0, 0, 0))

有谁知道为什么以及如何解决?

标签: pygamepep

解决方案


的第二个参数render是布尔值并控制锯齿。它必须是True而不是1

welcome = welcome_font.render('text', True, (0, 0, 0))

推荐阅读