我一直在尝试学习诅咒(Unicurses,因为我在Windows上),并且一直在遵循一个教程,但是我被卡住了。我遇到以下错误消息:
D:\Python34>python ./project/cursed.py
Traceback (most recent call last):
File "./project/cursed.py", line 35, in <module>
main()
File "./project/cursed.py", line 20, in main
obj_player = Player(stdscr, "@")
File "D:\Python34\project\cursedplayer.py", line 10, in __init__
self.max_x = stdscr.getmaxyx()[1] - 1
AttributeError: 'c_void_p' object has no attribute 'getmaxyx'
我能从中得到的是,当试图在两个文件之间获取stdscr变量时,出现了一些问题。下面是一个具有我要调用的函数的文件:
^{pr2}$下面是调用中定义的函数的主文件诅咒玩家.py公司名称:
from unicurses import *
from cursedfunction import *
from cursedplayer import *
#lines is 80
#columns is 25
def main():
stdscr = initscr()
if not has_colors():
print("You need colors to run!")
return 0
start_color()
noecho()
curs_set(False)
keypad(stdscr, True)
obj_player = Player(stdscr, "@")
update_panels()
doupdate()
running = True
while running:
key = getch()
if key == 27:
running = False
break
endwin()
if (__name__ == "__main__"):
main()
我很感激你的帮助。我一直在四处寻找,但没有找到任何与我的问题有关的东西。因为这个错误,我无法继续我正在遵循的诅咒教程。谢谢你的阅读。在
在(cursedfunction.py不包含,因为它没有任何相关信息,只是一个生成颜色的函数)
啊!我很笨。错误消息提供了我需要的所有信息,特别是stdscr没有一个名为“getmaxyx”的函数。我输入了错误的命令!在
从这个开始:
为此:
^{pr2}$…能够以我需要的格式传递信息。我不知道为什么它在教程中起作用,但我责怪魔法。在
相关问题 更多 >
编程相关推荐