Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Is scene.Node implemented in Xcode App template?
-
I have succesfully managed to create a standalone using the Xcode PythonistaAppTemplate with a fairly simple script. I have another script I wish to turn into an app that uses shapenodes and spritenodes in an animated scene within a custom UI component. However when I run the stand alone version created by Xcode i get the following error:
'NoneType' object has no attribute 'line_width'
at the point of insatantiation - None of my nodes seem to work :-( Are nodes implemented in the Xcode template?
Many thanks for any help.
-
Iirc, the scene module in the template predates the scene node concept. In pythonista 1.5, scene was more like scene_drawing.
-
Thanks JonB,
Can you animate scene_drawings?
-
look under the docs about the classic render loop -- that should all work. basically, your scene has a draw method there are probably some tutorials over on pythonista-tools.
see, for example, https://gist.github.com/BashedCrab/9098744
The docs for the old scene module are here:
https://web.archive.org/web/20150219144916/http://omz-software.com/pythonista/docs/ios/scene.html
I think the Layer and Animation classes still exist in the new scene, so you should still be able to test in the app.basically, your scene's draw method is called at 60 fps, and there you would implement whatever game logic needs to happen, one frame at a time. usually your "nodes" are just plain objects that implement their own draw /update method, which is called from the scene.draw, and lets the objects update their state, or implement their own internal timing of actions, etc. scene.Layers are sort of like nodes, in that they can be moved around and animated. iirc scene.Animations let you create more complex animation sequences, similar to Actions.
-
Thank you- that’s very helpful indeed. I will have a go a rewriting using layers and animation.