我正在尝试使用下一堂课:
class GameStatus(object):
"""Enum of possible Game statuses."""
__init__ = None
NotStarted, InProgress, Win, Lose = range(4)
def getStatus(number):
return{
0: "NotStarted",
1: "InProgress",
2: "Win",
3: "Lose",
}
在另一个类中(都在同一个py文件中)。在他的方法init的另一个类中,我做下一件事:
class Game(object):
"""Handles a game of minesweeper by supplying UI to Board object."""
gameBoard = []
gs = ''
def __init__(self, board):
self.gameBoard = board
gs = GameStatus() //THIS IS THE LINE
当我尝试运行游戏时,出现下一条错误消息:
File "C:\Users\Dron6\Desktop\Study\Python\ex6\wp-proj06.py", line 423, in __init__
gs = GameStatus()
TypeError: 'NoneType' object is not callable
我究竟做错了什么?
桃花长相依
相关分类