Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Background sketchpad manipulation

Hi,

I am programming a visual multi-target foraging experiment in OpenSesame and while prsenting my stimuli on one side (left) of the display I want to design a drop area for stimuli on the left side. So participants can pick up targets on the left via mouse click and then they should click again somewhere on the drop area and the target re-appears there. The experiment is programmed already to some points (meaning I only need to add the drop area and modify the response loop based on that) and I would like to have some general expert advice at this step about which approach I better to choose in designing the drop area.


Thanks,

PariShad

Comments

  • Hi @Pari ,


    Could you send us your experiment so far, so that we can take a look?


    In general, you could:



    • Determine the x-coordinates of the target location (by collecting another mouse response)


    • Use a `feedback` item that is similar to the previous sketchpad except that the stimulus is moved to the "drop location"


    If you also want to animate the target being dragged, thinks get a bit more complex.


    Cheers,


    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited April 2023


    Hi Lotje,

    First of all, sorry for my late response. I ended up designing a drop area as an image file using Affinity designer. Afterwards, I positioned the image on a preferred position on a sketchpad and added the below code to my check-clicked function to check if an item is dropped within the area of this image. Then I simply draw the same object using psychopy.visual.ImageStim function.

    clicked_on_drop_area = False
    
    while not clicked_on_drop_area:
    
    button, drop_pos, timestamp = mouse.get_click()
    
    x_drop, y_drop = drop_pos
    
    # Check if the click position is within the boundaries of the image
    
    if (x_drop >= (drop_image_screen_left + 40) and x_drop <= (drop_image_screen_right - 40)) and (y_drop >= (drop_image_screen_top + 40) and y_drop <= (drop_image_screen_bottom - 40)):
    
    clicked_on_drop_area = True
    
    break
    
    dropped_element = {'Type': selection['Type'], 'X': x_drop, 'Y': y_drop, 'Time': selection['Time'], 'Index': selection['Index']}
    
    drop_element(dropped_element)
    

    I am currently figuring out how to write a proper in-line script for logging my data as in each iteration I need to log the dropped_element variable which is defined as a dictionary with several values and this variable is defined in a function. I would be thankful to receive any hint or idea how this can be done.


    Many thanks,


    Best wishes,

    PariShad

Sign In or Register to comment.