Hi everyone,
I am working on an experiment right now and am having trouble with the editable textbox. I have two loops in the experiment that use an editable textbox. The first one works, as shown in the first image. The second editable textbox (second image) is unresponsive, and doesn’t show any red cursor, even though it has the exact same parameters as the first textbox. Is there any way to fix this?
This is a mix of being a bug and not - what’s happening here is that the Mouse component is listening for mouse clicks, so when you click on the Textbox (to give it focus), the click is picked up by the Mouse component rather than the Textbox. If you replace the Mouse component with some other method of ending the routine, as you have in the previous Routine, it should work!
However, this is also a bug as an editable textbox should have focus by default, without needing to be clicked on. I think what’s happening is that focus is remaining on the (no longer drawn) textbox from the previous Routine, similar to how only one Textbox would start off with focus if you had two on screen at the same time. Even though it’s not being drawn, the first Textbox still exists, so PsychoPy is seeing it as the main one. I’ll add a bug fix to bring control to a textbox if it is the only one on screen!
If you want the space key to be used to end the routine I would just add a standard keyboard component for this - Are you still working from the same gitlab repository so that I can take a look where you are at?
Using the textInput demo posted above you can copy and paste the code and text component into your experiment. To then make it so that the space also ends the routine the following edit was needed:
if 'space' in keys:
continueRoutine = False
I have adapted the routine in your task where you wanted a typed response in order to illustrate (please note I removed any reference to the xlsx files as I didn’t have them
This should do what you need for now though, just use the same method in your other routines CortexMini.psyexp (41.3 KB)
This works really well, thank you! I do have one question about capitalization of the responses - is there a way to use capslock instead of shift? I tried to use it earlier on in code when I was working on this experiment, but it didn’t seem to be processing the key.
Fantastic - pleased it works - please cold you mark that response as the ‘solution’ for future users?
For your second Q, capslocks is a difficult one because the keycode for capslock on mac isn’t currently recognised (Caps locks button is not working) is it essential for you to have capslocks logged in your responses?
The reason I wanted to use capslock was because with shift, the user has to press it every single time they want to capitalize a letter, so I was trying to find an alternative to that. Is there something that would capitalize the letters without them having to do this?
try this (see the subtly change made to the code_2 component) CortexMini (2).psyexp (41.4 KB)
essentially you just want to make sure any time a letter is added to the text object is is in upper case i.e. on the python side (left) everything reads: text.text = text.text + keys[0].upper()
and on the JS side (right) everything reads text.text = text.text + textAdd.toUpperCase();
The letters are all capitalized, thank you! However, whenever keys like ‘backspace’ are pressed, those also show up on the screen capitalized. Is there a way I can erase those so they don’t show up?