Increase text according to clicks

Hello, I’m really new to PSYCHOPY. I am trying to put together a first and very simple experiment.
If the experimenter presses the space bar - a certain text enlarges according to the number of clicks and the same size (and the number of clicks) will also be recorded and received in the input file.

I would love to know how to do that, and in addition I would love to be guided by tutorials or videos that are helpful for beginners.

with gratitude!

Hi @Avishai_D , would be useful to have more info about your task, e.g., does number of clicks mean sounds or mouse clicks?

@dvbridges
thank you for your response

In the experiment, the subject will be presented with a stimulus (an object such as a polygon) and will have to press the right key to increase its size or press the left key to decrease its size.

The effect of the change should be in relation to the whole stimulus, so that if I increased the size of the stimulus by one inch, it would increase simultaneously in the horizontal and vertical dimension.

I want the change itself to be recorded in the input file [for example: switching between a 5-inch and a 6-inch square] and also the number of responses [the number of times the keys were pressed] for each trial

Thank you.

Sure, you can use Builder, with a keyboard (in this example called key_resp) set to record all keypresses and not to end the routine on a keypress, a polygon (called polygon) and a code component. In your code component, in the relevant tabs:

# Begin Routine
currentKP = 0
sizeModifier = .05

# Each Frame
if len(key_resp.keys) > currentKP:
    currentKP = len(key_resp.keys)

    if key_resp.keys[-1] == "right":
        polygon.size += sizeModifier 
    elif key_resp.keys[-1] == "left":
        polygon.size -= sizeModifier 
    elif key_resp.keys[-1] == "space":
        continueRoutine = False

# End Routine
thisExp.addData("polySize", polygon.size)

The code component checks for keypresses, and increases or decreases the size depending on whether left or right key is pressed, then space to end the routine. Builder will automatically save all your keypresses. If you want to save the size of the shape, you use the thisExp.addData command above. The example Builder file is attached.

resizePoly.psyexp (8.7 KB)

@dvbridges
Thank you so much for your time and willingness!
you helped me alot.

1 Like