psychopy.org | Reference | Downloads | Github

Make PsychoPy output copiable?

Hi,

in this great and very helpful forum I’ve seen many topics in which error messages from the PsychoPy output windows were posted as screenshots. This is probably due to the fact that the output text is (as far as I know and in version 1.90.2) not easily copiable, neither by the missing Edit menu nor by using Ctrl+A / Ctrl+C etc.
However, topics including error messages in text form would make them much easier to find for search engines.

Therefore, I was wondering if it would be possible to allow copying in the PsychoPy output window in future versions.

Best regards
Torge

It is already possible using right-click on the mouse, but you’re right that I think the current set up doesn’t handle Ctrl-C properly (due to confusion about what the current view is active?). Happy to take a pull request on this

Thanks for your reply! I tried right-clicking, too, but on my setup (1.90.2 on Windows 7), it doesn’t have any effect. There is no menu and I can’t even mark the text. Is that a known issue?

Oh, no I wasn’t aware of that. Is this the output window from Builder or in the botom of Coder?

The Builder output. In the coder output, the right-click menu and all shortcuts work well.

Ah, OK, I never noticed that. We could explore why it doesn’t work there and/or add a copy button to the dialog if it can’t be fixed

That would be great. Let me know if you need any tests on my system.

Speaking about right-clicks in Builder: if a file has been selected in the conditions field of the loop property window, a right-click doesn’t have any effect either even though the tooltip says it’s supposed to preview the file contents.

I can copy the text from the output window of builder BUT only the text that is visible.
For example, in this screenshot, I’ve highlighted/copied the text that is visible, but there is more hidden text (if I were to scroll upwards) that cannot be copied. Ideally, I could just click and drag so that I can highlight/copy text as I scroll upwards, but this is not possible. Enlarging the window doesn’t work either because it just gives you a larger grey border around the output (see screenshot). Any solutions?

Hi @Ryan_Blything, one thing you could do is save the text being printed in an in-memory text stream using the python io module. E.g., in a code component, and relevant tabs:

# Begin Experiment
import io
output = io.StringIO()
output.write('Starting experiment...\n')
counter = 0

# Each Routine
# In your print statement, make your output stream the target for print
print('trial: {}'.format(counter), file=output)  
counter+=1 

# End Experiment
with open('outputTextFile.txt', 'w', encoding='utf8') as f:
    f.write(output.getvalue())

output.close()
1 Like