获取场景未定义错误,谁能看到我哪里出错了?
我在所有的类里都遇到了“scene is not defined”的错误。这是我漏掉了什么吗?
class Survived(scene):
quips1 = [
'Your good at this game',
'Way to go!',
'I didnt think you would make it'
'Thank for playing this game!'
]
def enter(self):
print Survived.quips [randint(0, len(self.quips1) -1)]
exit(1)
class Scene(object):
def enter(self):
print "This scene is not yet configured. Subclass it and implement enter()."
2 个回答
1
我想提醒一下,如果你在代码前面忘记加上
from manim import *
,也会出现这个问题哦...
2
Python是区分大小写的,所以你要正确拼写Survived(Scene)
。另外,Scene
这个类必须在Survived
之前定义,否则你会遇到一个未定义的错误。
大概是这样的:
class Scene(object):
def enter(self):
print "This scene is not yet configured. Subclass it and implement enter()."
class Survived(Scene):
quips1 = [
'Your good at this game',
'Way to go!',
'I didnt think you would make it'
'Thank for playing this game!'
]
def enter(self):
print Survived.quips [randint(0, len(self.quips1) -1)]
exit(1)