When I add or edit code components in Builder, there is an option for “Code Type” at the top of the window. This defaults to “Auto->JS”. How can set the default option to “Py”.
I.e., I’d just like to see the simple python code without any additional conversions to javascript.
According to the GitHub page that @dvbridgesreferenced, the issue should have been resolved. It is still present, however, in the current PsychoPy version (2020.1.3. on macOS).
To be more precise, when I add a code component and set the code type to “Py”, this is actually reflected correctly in the .psyexp file:
I’d agree with @Holger, it affects the joy of using the code component. And I feel it might actually have substantial consequences (like overwriting code? forgetting to reset?). Alternatively, is there a way to get PsychoPy to remember/set the code property window width or font size?
(On that note: I use/downloaded v2020.1.3 from Github, but “PsychoPy > About” says it’s v2020.1.2)
@Holger, yes it looks like the fix is in place in the Github repo, but was not released. I imagine the fix will be added to the next standalone release. In the meantime, if you wanted to add the fix to your own copy, so your code type prefs are saved each time you close the code box, you can add the following file to your psychopy installation. On Windows, go to your standalone PsychoPy path and navigate to the code component dialog code, something like
Add the following file to the directory, overwriting the existing file, and when you start PsychoPy the code type should be saved each time you close your code dialogs.
Thanks a lot, David (@dvbridges), for your help! I can confirm that replacing the dlgsCode.py file solves the problem on macOS. There, the path of the file that needs to be replaced is
You can do so by right-clicking on the PsychoPy3 app and then choosing “Show Package Contents”. After that follow the path Contents −> Resources −> lib −> python3.6 −> psychopy −> app −> builder −> dialogs).