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.
Multiscene switch image after specified time
-
Hi,
I'm new to pythonista and I've been trying to recreate the "Flanker Test".
I am trying to have an image of arrows appear on screen for a specified amount of time (say 1 second) before disappearing. At this point the person can touch on screen buttons with the direction the middle arrow was pointing (either left or right). The input of the button will be recorded in a CSV file as well as the reaction time.
I was previously trying to do this using scene and a timed present_modal_scene but after a few image changes the program would slow to a crawl.
I decided to try using a mutliscene structure but I'm having trouble presenting the images and having it change after the time is up.
The flanker test seems straightforward but I can't find any examples of similar processes. If anyone could provide some example codes for me or point me in the right direction it would be much appreciated. Thanks ! -
Is each image presented as its own scene? Or just the buttons?
why do you need a multiscene for this? Seems like it would be a lot cleaner timing, etc to be a single scene with SpriteNodes for the arrows, and then custom touch handling to simulate buttons.
-
Right now each image is presented as its own scene. So your suggesting using one scene and adding the arrows as a SpriteNode. That way I can have the SpriteNode update within the scene rather than loading an entirely new scene to show an image?
-
Right. I think you could have three sprite nodes, two for the controls, and one for the image. Since everything is going on one clock, i would think itd be easier to do accurate timing (in units of 1/60 sec at least. touches might have more precision, but i am not sure).
-
Thanks for the suggestion. I've been playing around with the idea but running into some trouble.
I have a sequence of 40 images (made up of 4 unique images). Arrow_display_time = 0.5 seconds, Response_time =1.5 seconds
If they press the button while the arrow is up it should switch to the blank screen. Only the first button response for the image is recorded, the rest are ignored.
Sequence=[4, 3, 1, 3, 2, 4, .....] #Sequence of image numbersDo you have any examples of how I can switch the SceneNode through the sequence while keeping track of the timing?
I'd post the code I'm working with but it doesn't really work so I don't think there's a point. -
https://gist.github.com/86effb0ad8d865eb843ec341afe35ef6
I am not really a scene expert, but here is an example using actions to control the timing, and a flag to control whether buttons are armed. -
Thank you so much for the example! I'll take a look and see what I can understand from it.