Forum Archive

Pythonista 3 Bug report

wolf71

Traceback (most recent call last):
File "/var/containers/Bundle/Application/C653EC7F-B29A-4BAD-8AA1-1B562C926512/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/site-packages/scene.py", line 183, in _draw
if self.fixed_time_step and self.view:
AttributeError: 'MyScene' object has no attribute 'fixed_time_step'

ccc

@wolf71 Can you please provide a small snippet of code than causes this error?

omz

@wolf71 A common reason for this error is when you override Scene.__init__, but don't call the base class's __init__ method.

wolf71

import scene

fmt = """Tilt your device to change colors...
        x={}
        y={}
        z={}"""

class MyScene(scene.Scene):
    def __init__(self):  # This scene runs itself
        scene.run(self, frame_interval=15)  # Lower the FPS

    def setup(self):
        self.center = self.bounds.center()

    def draw(self):
        x, y, z = scene.gravity()
        r, g, b = abs(x), abs(y), abs(z)  # No negative colors
        scene.background(r, g, b)
        scene.tint(1-r, 1-g, 1-b)
        scene.text(fmt.format(x, y, z), font_size=32,
                   x=self.center.x, y=self.center.y)

MyScene()  # This scene runs itself

omz

@wolf71 If you modify the following lines, the error should go away:

```

...

class MyScene(scene.Scene):
def init(self):
scene.Scene.init(self) # <== IMPORTANT!
scene.run(self, frame_interval=2)

...

wolf71

It's ok. Thanks.
The Pythonista 3 it's greate. upgrade from Pythonista 2.