为什么libtcod.console_put_字符继续回来”ctypes.ArgumentError"

2024-05-18 14:29:26 发布

您现在位置:Python中文网/ 问答频道 /正文

目前的代码: http://pastie.org/private/wcjqodm9pm66aorks9jp7w

运行代码时,我得到一个错误:

Traceback (most recent call last):
File "C:/Users/Tyler/Documents/Third Party Games/Python/RogueLike/RogueLike.py", line 224, in <module>
render_all()
File "C:/Users/Tyler/Documents/Third Party Games/Python/RogueLike/RogueLike.py", line 173, in render_all
object.draw()
File "C:/Users/Tyler/Documents/Third Party Games/Python/RogueLike/RogueLike.py", line 69, in draw
libtcod.console_put_char(con, self.x, self.y, self.char, libtcod.BKGND_NONE)
File "C:\Users\Tyler\Documents\Third Party Games\Python\RogueLike\libtcodpy.py", line 765, in console_put_char
_lib.TCOD_console_put_char(con, x, y, ord(c), flag)
ctypes.ArgumentError: argument 2: <class 'TypeError'>: Don't know how to convert parameter 2

问题似乎出在第69行:

^{pr2}$

它不喜欢self.x或self.y

我在213号线也遇到过类似的问题:

player = Object(SCREEN_WIDTH/2, SCREEN_HEIGHT, "@", libtcod.white)

但是我设法用它们的实际值代替屏幕宽度和屏幕高度,而不是变量名来解决这个问题。在

但我似乎不能用这种方式解决我目前的问题。在


Tags: inpyselfpartylineusersgamesdocuments

热门问题