The Builder saves your experiment in a .psyexp file. Every time you make a change and push "Run", Builder then generates a new .py file, which is what PsychoPy actually runs. This is what you see when you push the "Compile script" button, but NB, that step is entirely optional and is only necessary if you want to see what the underlying code is doing or want to jiggle with it. And it is important to realise that this .py file is strictly temporary. It is forever being regenerated by Builder as required. So if you make a change in it and like what it does, you need to save it with a different name, which breaks its link with Builder (which will seamlessly create another one next run).
NB this relationship is strictly one-way: Builder generates .py files, but you can't create or modify a .py file and turn it back into a Builder experiment. Once you have modified the .py output from Builder and saved it as another file, it can then only be run within the Coder environment, as pure Python code. You then have much more flexibility in what you can do, but you lose the ability to graphically lay out your experiment. You're stuck forever in Python code. It's not a bad route though: use Builder to do the leg work of creating the structure of your experiment, and then if you find you hit limits with what it allows you to do, switch to the .py file and just make minor or major tweaks as required.
The goal is that most people should be able to work entirely within the Builder environment. But for some particular experimental requirements or designs, there is complete flexibility awaiting in the Coder view.
Cheers,
Michael
On 30 Mar, 2012, at 11:23, Jack Keegan wrote:
> Hi there,
>
> I've had PsychoPy2 installed for a while but just getting round to using it now. However, when I try to create and experiment using builder and then hit 'compile script' it brings up the code editor. If I make changes here, it doesn't seem to save. I can run the changes from here and they will take effect. However, if I save and close this code editor, I lose all my changes. Is this normal behavior?
>
> Cheers,
>
> Jack
--
Michael R. MacAskill, PhD michael....@nzbri.org
Research Director,
New Zealand Brain Research Institute
66 Stewart St http://www.nzbri.org/macaskill
Christchurch 8011 Ph: +64 3 3786 072
NEW ZEALAND Fax: +64 3 3786 080
On 29/03/2012 23:23, Jack Keegan wrote:
> Hi there,
>
> I've had PsychoPy2 installed for a while but just getting round to
> using it now. However, when I try to create and experiment using
> builder and then hit 'compile script' it brings up the code editor. If
> I make changes here, it doesn't seem to save. I can run the changes
> from here and they will take effect. However, if I save and close this
> code editor, I lose all my changes. Is this normal behavior?
I addition to Mike's comments, note that if you make changes and save
your script it's probably a good idea to save it with a different name.
When you compile a builder experiment to script it always uses the same
name as the experiment, and if you've made changes there it will look
like your changes "didn't seem to save".
But if the confusion is that you were expecting the code changes to
propagate back into the builder environment then Mike's right - that's
not possible.
all the best,
Jon
--
Jonathan Peirce
Nottingham Visual Neuroscience
This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

Jon,
I've just started working with PsychoPy this afternoon! Let me start by saying that it is marvelous!
I ran int the issue in this thread and was wondering why there isn't an option in builder to add a little extra code. For example, I wanted to set a patch to have a random duration on each trial so I set the Stop (duration) to $random.uniform(1,8) and added "import random" to the top of my script. Of course, I could no longer make adjustments with the builder. Couldn't there be a "User defined" button that would open a little text box where a few lines of code could be added? Then builder would always put this user-defined code at the top of the file? Eprime has something like this (I forget what it's called) that I use quite frequently. Not a big deal I know, but would be nice not to have to keep track of all code I plan to add and instead just add code as I build the experiment in builder view.
Thanks for a great program!
Paul
--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To post to this group, send email to psychop...@googlegroups.com.
To unsubscribe from this group, send email to psychopy-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/psychopy-users/-/K1dQpjFdv_gJ.
For more options, visit https://groups.google.com/groups/opt_out.
To view this discussion on the web visit https://groups.google.com/d/msg/psychopy-users/-/CLgf2pR-edwJ.
Hi,Michael said: " Once you have modified the .py output from Builder and saved it as another file, it can then only be run within the Coder environment, as pure Python code."My question, the modified .py output cannot be opened in Builder anymore, from a .py file to a .psyexp file?Thanks,Dana
On Friday, March 30, 2012 3:53:31 AM UTC+5:30, Jack Keegan wrote: