Hello,
I am making an experiment where participants must type the string they see on screen. The current code I have shows the response, but I would like it to be capitalized using the capslock key and I am not sure how to go about doing this. Here is the code I have right now:
You can use the function upper() around the text that you’re displaying.
Also, I’m not sure if you’re just using this on a local computer using the python code, but if you’re planning to run this online with the JS code, you won’t be able to use any import functions. You will also have to have a JS only code and python only code for this because upper() in python doesn’t translate to JS. in the JS only code, you’ll use .toUpperCase() instead.
Thank you for the response!
I was planning to run this online, and I do have it on a local computer. Right now I have the code as Auto - would it be best to set everything to JS only then for it to run online?
Also, the text that is being displayed is what is being typed by the participants, so would I be placing upper() around copyText2.setText(textFill)?
if keys[0] in allLetters:
textFill +=upper(keys[0])
Or:
if keys[0] in allLetters:
textFill +=keys[0]
textFill = upper(textFill)
Although, I’m not too terribly familiar with the way you’re adding letters. I use the ''.join() method.
For the python to JS thing, there are a few functions that don’t translate well. One of the major issues is with import functions because they don’t exist in JS. Save yourself a TON of trouble later by avoiding those at all cost now. Check out this thread and this crib sheet for help with translations! I’m honestly glad I mentioned the import function because fixing that later is not fun.
I tried using this method and it didn’t work - if it wouldn’t be too much trouble, would you mind sharing how you usually add letters with the ''.join() method? I had tried using that earlier when working on this experiment and my issue was that whenever I typed in ‘capslock’ and ‘backspace’, the actual words would show up on the screen.
And thank you for mentioning the import functions!