为什么libtcod.console_put_char会一直返回" ctypes.ArgumentError"

时间:2015-11-08 01:51:36

标签: python ctypes libtcod

到目前为止的守则: 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行:

libtcod.console_put_char(con, self.x, self.y, self.char, libtcod.BKGND_NONE)

它不喜欢self.x或self.y

我在第213行遇到了类似的问题:

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

但我设法通过将SCREEN_WIDTH和SCREEN_HEIGHT替换为实际值而不是变量名来解决这个问题。

似乎我无法以这种方式解决当前的问题。

0 个答案:

没有答案