Howdy, Stranger!

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

Supported by

[open] Image button functions

edited November 2015 in OpenSesame

Hey guys,

I am currently building a procedure for Evaluative Conditioning studies and I have got a small problem, so I hoped that perhaps someone could have some ideas on that!

In the recognition task that I implemented I always present one picture that was previously paired with one of 15 stimuli and I ask participants to choose the one with which they think the picture was paired. I would like to gather the coordinates of the picture they clicked on, so that later I can assess if they chose the correct one.

Does anyone have an idea what kind of command I should use?

I was wondering about using Image_button functions, so that they could click on the picture, but don't know where I should apply this part of the procedure. Shall I add it in the script of a sketchpad in which I am presenting all the stimuli or is there a new section I should add below the sketchpad?

How to collect data by clicking on the pictures and have an outcome variable since the stimuli will be randomized and I would need to know then which one exactly the participant chose?

I would be super grateful for any feedback and help here.

Cheers,
Boris

Comments

  • edited November 2015

    Hi Boris,

    I think it would be best for you to use an inline_script for this. The first step is to create a canvas, so that it would present the 15 pictures in a way similar to the sketchpad. http://osdoc.cogsci.nl/python/canvas/. The canvas can be built in the 'prepare-phase' of your inline_script. You then show it (e.g. exp.canvas.show()) in the run-phase.

    Right after that, it's time to collect a mouse response (i.e., in the same run-phase). All the relevant functions are here: http://osdoc.cogsci.nl/python/mouse/. You see that the mouse.get_click() command returns not only the button and time, but also a set of coordinates. With these coordinates you could find out which picture participants clicked. Going back to the run phase, you could make a variable called picture_coordinates, and give it a value like so:

      pics = [(100,100), (100,200),(100,300),(200,100),(200,200)] #etc.
    

    Every tuple in this list would refer to the center of a picture; the third element of the list would refer to the center coordinates of the third picture. Also note that it may be convenient to first create this variable and then build your canvas:

       exp.canvas.image('image1.png', x=pics[0][0], y=pics[0][1])
       exp.canvas.image('image2.png', x=pics[1][0], y=pics[1][1])
       exp.canvas.image('image3.png', x=pics[2][0], y=pics[2][1])
    

    Back to the run-phase, we want to do some response processing. Let's say your pictures are size 80x80 pixels. This would mean that the third picture was clicked if (100-40)<x<(100+40) and (300-40)<y<(300+40). Here, x and y are respectively the first and second element of the coordinate variable that was returned by our mouse.get_click() command. Hence, right after this command you could first insert the lines x=coordinates[0] and y=coordinates[1], (that is, if you named this variable coordinates; in the example of http://osdoc.cogsci.nl/python/mouse/ it's named 'position').

    In the end, you could do something like this:

      if (pics[0][0]-40)<x<(pics[0][0]+40) and (pics[0][1]-40)<y<(pics[0][1]+40):
              picture_clicked = 1
      elif (pics[1][0]-40)<x<(pics[1][0]+40) and (pics[1][1]-40)<y<(pics[1][1]+40):
              picture_clicked = 2
      elif (pics[2][0]-40)<x<(pics[2][0]+40) and (pics[2][1]-40)<y<(pics[2][1]+40):
              picture_clicked = 3
                        # et cetera.
    

    Cheers,

    Josh

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games