pygame - 为什么我会收到此 PEP 警告?
问题描述
我在我的 Pygame 中得到了这些鼓舞人心的警告:
Expected type 'bool', got 'int' instead
它们都与这样的变量相关,我为我的文本定义字体等:
welcome = welcome_font.render("Welcome to mosquito hunt! ", 1, (0, 0, 0))
有谁知道为什么以及如何解决?
解决方案
的第二个参数render
是布尔值并控制锯齿。它必须是True
而不是1
:
welcome = welcome_font.render('text', True, (0, 0, 0))
推荐阅读
- python - 如何从 Python 启动 Linux 提升权限窗口?
- python-3.x - python datetime strptime 意外输出
- r - 滚动平方根等函数
- jquery - ajax 在成功参数中是否有“值” - jquery?
- javascript - JavaScript onkeydown / addeventlistener
- javascript - 使用 angularfire2 分片到多个数据库
- angular - 无法绑定到“行”,因为它不是“ngx-datatable”的已知属性
- python-3.x - python3类型提示参数的不同类型
- javascript - 如何从Javascript中的十进制数字中删除零
- javascript - Vue-boostrap 卡不显示登机