所以,我写的代码工作得很好,但是一个警告不断出现。我不知道这是什么意思,也不知道该怎么办。警告如下:
Warning (from warnings module):
File "C:/Users/LENOVO/Desktop/GROOT!/ch.py", line 41
win.blit(char, (x, y))
DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
我不知道是否需要更改代码中的某些内容。请告诉我我需要做什么
警告意味着
x
和/或y
具有浮点值,但blit()
(以及PyGame中的其他函数)需要整数值。您可以使用int(x), int(y)
来更改它警告还提示,这次它会自动将其转换为整数,但在下一个PyGame版本中,它可能不会这样做,最好手动使用
int()
您可以使用
或者使用
int(x), int(y)
将x和y转换为int相关问题 更多 >
编程相关推荐