Howdy, Stranger!

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

Supported by

Rating scales on a canvas?

Hi guys,

I have another problem with my experiment :blush:
I want to present 4 images on a canvas (top left, top right, lower left, lower right).
For each of these images I want to show a rating scale with 2 possible answers. So under every image there should be a rating scale on the same canvas.
How is it possible to implement a rating scale on a canvas?

Thanks for your help!

Comments

  • Hi Flippy,

    1.
    the easiest way is to define buttons (e.g. the number buttons).
    In your case i would implement something in the images "press 'n' for no" or "press 'x' for yes".

    If you want to do it with mouse presses you need to define the position of the response fields. Quite more complicated.

    2.
    Why don't you put your 4 images into one image if they shall be presented at the same time?
    So you need to present only one canvas.
    Another option would be to present the images one after the other. Which seems more logical to me, but i do not know your experiment.

    Greetz
    Stephan

  • Hi Flippy,

    Here a code with mouse clicks. This code works with two Items on one page. You need to find the rectangles (x,y coordinates) of your canvas on your own :)

    StrengthOfRep = canvas()
    StrengthOfRep.image(pool['StrengthOfRep.tif'])
    
    list_x = [-378,-291,-204,-117,- 28, 60,147,234,321]
    kin_list = []
    
    for i in range(9):
        StrengthOfRep[i] = Rect(x=list_x[i], y=-57, w=59, h=59, color='white', penwidth=1)
        kin_list.append(StrengthOfRep[i])
    
    vis_list = []
    for i in range(9):
        StrengthOfRep[i+10] = Rect(x=list_x[i], y=181, w=59, h=59, color='white', penwidth=1)
        vis_list.append(StrengthOfRep[i+10])
    
    var.vis=None
    var.kin=None
    #def StrOfRep():
    StrengthOfRep.show()
    my_mouse = Mouse(visible=True)
    
    while (var.kin==None or var.vis==None):
        button, (x, y), time = my_mouse.get_click()
        for i in range(9):
            if (x, y) in kin_list[i]:
                var.Stim='kin'
                var.Resp=i+1
                var.kin=True
                for ii in range(9): #set all others white
                    kin_list[ii].penwidth = 1
                    kin_list[ii].color = 'white'    
                #mark the selected one
                kin_list[i].penwidth = 4
                kin_list[i].color = 'blue'
                log.write_vars()
                StrengthOfRep.show()
            elif (x, y) in vis_list[i]:
                var.Stim='vis'
                var.Resp=i+1
                var.vis=True
                for ii in range(9): #set all others white
                    vis_list[ii].penwidth = 1
                    vis_list[ii].color = 'white'    
                #mark the selected one
                vis_list[i].penwidth = 4
                vis_list[i].color = 'blue'
                log.write_vars()
                StrengthOfRep.show()
    
Sign In or Register to comment.