可视变量更新

时间:2017-02-22 11:52:06

标签: python variables vpython

我遇到了显示错误。 这是我的代码

        onerot = 0
        if outerball.pos.x >= (self.r - 0.1):
            if self.rotations == 0:
                stopt = time.time ( )
                onerot = stopt - startt
                print(onerot)
            self.rotations += 1

        # update variable outputs
        timey.text = "time: %1.f" % onerot + " seconds"
        timex.text = "time: %1.f" % self.t + " seconds"
        nmrRotations.text = "rotations: %1.f" % self.rotations

有人可以解释如何替换if语句中计算的“onerot”变量的值,并将其替换为值0,并使用if语句之外的onerot变量 image shows Onerot value as 0 and the other variables updating

感谢

0 个答案:

没有答案