Run() command and graphic code in Pythonista
shyamal last edited by
Why does the StopWatch example have a run() function instead of using a main function with the game elements of setup and draw? Is this something special to Pythonista? Please let me know. How do you pass parameters to the main loop in Pythonista? Is that even possible?
JonB last edited by JonB
Scene's get run using the run method.
setup and update get called by the system, you do not call them yourself.
You can define an
__init__method for scenes, which let you customize them prior to creation, but the scrne has not started running yet, so you cannot manipulate the nodes in init.
See the docs for the scene module.
ui module works a little differently - custom views can implement layout and draw methods, which are called by the system. You use the present() method to show your view. But, you can manipulate the view heirarchy in "real time", whereas in scene, interacting with scenes need to be done from methods called by update or setup.
If you are asking how to pass "commandline" arguments, you long-press the play button, which will then let you specify the args. then you check sys.argv inside the body of your script.