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.
How can i pass data between different scenes and/or ui views
-
I get a completely black screen when set pause to true and then set it to false
-
Look at the brickbreaker example in examples/games folder (BrickBraker.py in Examples/Games). It uses 'pause and present_modal_scene for displaying menu and I hope it will be useful in understanding . (BTW, you can also use global variables to pass data.)
-
https://gist.github.com/6dacbc24e874bf4458772cc4a2bc4aad
This is an example of using pause in a sceneview -
@walterwang, could you briefly explain why you want to run the blocking login request in Scene?
-
@mikael I have a login screen which when authenticated gets a request.cookie that is used to identify the user as a session in flask. The setup screen requires information from the user's account, and therefore cannot be updated or rendered until the user logs in from the login screen. But once logged in, I only need to post the request once to get the needed information. So far I have a try block and a setup_query_once = True boolean, which is set to false after setting up once in the update function.
-
why not just handle evrything in your login code, i.e inside the ui callback? it seems really clunky to do that within update.
-
@JonB, I can do that with the request cookies part of the login, but there is also additional information that needs to be rendered only once. This information is only available once you log in.
-
What I mean is, the login code should be run in the UI portion of the code. Then once you are logged in, begin rendering the scene (using pause). Did you try the example above that showed use of pause?
I would just worry about running anything blocking or time consuming within the update loop. I think your original code would have kept trying to login -- you should only send a single login request, and only retry with a timeout.
-
Hi JonB thanks for the advice. sorry the code I posted here was too simplified, (My actual code was just a single if statement testing a boolean variable) But I have changed it to a better way of adding subview, I don't know why it didn't work at first. So the login code is in the setup now. I haven't tried using pause yet, so far I am just using add_subview when initializing the scene for the first time, and scene.hidden =True to hide the previous menu.
Thanks for all the help!
-
out of curiosity ... what is this going to become? a multiplayer game?
-
yes, its a turn based multiplayer game. It will be a lot like chess.