Howdy, Stranger!

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

Supported by

[open] Set duration and change information on the slide due to keypress

edited November 2014 in OpenSesame

Hi everyone,
I would like to present two pictures next to each other on the same slide for two seconds (The material is in a list in a loop and works so far). However participants have the option of making the picture on the right disappear so that they only see the picture on the left for the full two seconds (explanation: the picture on the right is aversive and so propably want to make use of that option. However, I do not want them to press only to finish early, so they should still see the stimulus on the left for the full two seconds). So I either want the picture to dissappear or just to be covered by a blank picture when they press a key (e.g. the space key).
My problem:

  • if I use a sketchpad, I can set the duration, but it won't react to the keypress, since the slide is already fully loaded (as I understood it)
  • if I use a form_base, participants can change the slide by pressing a key, but it seems that I can not set a duration
  • if I use to separate sketchpads, the first one including both pictures, the second one only showing the picture on the left when the first slide was ended using the space key, I am afraid that the picture on the left will not be the same as on the first sketchpad since a new one will be taken from the loop.

I hope this does not sound too messy. It would be great if anyone knew a way around this problem and would be willing to share it with me :)

Thanks, Helen

Comments

  • edited 6:32PM

    Hi Helen,

    I suggest you draw your images directly to a canvas in an inline_script. It's not much more difficult than using a sketchpad, but gives you more freedom and control over it.
    I give you an example of the basic idea. Probably, you'll have to try a bit, until it looks just like you want it to. If you get lost, you can have a look on the documentation page (this is also where I copied most of the code from) or ask again here in the forum.

    Here the example:

    from openexp.canvas import canvas
    from openexp.keyboard import keyboard
    
    
    my_canvas = canvas(exp)
    
    my_canvas.image(file_path_left)
    my_canvas.image(file_path_right)
    
    
    my_keyboard = keyboard(exp)
    t0 = self.time()
    
    while (self.time() - t0) < 2000:
    
        response, timestamp = my_keyboard.get_key()
        if response == 'key which makes the right image disappear':
             my_canvas.image(file_of_image_with_background_color)
             my_canvas.image(file_path_left)
        my_canvas.show()
    

    Good luck!

    Eduard

    Buy Me A Coffee

  • thanks a lot for your answer. My remaining problem is that I would like to take the images from a list in a loop and somehow I cannot find how to do that. Instead, the get_file function will work with a singe picture, not a list of pictures in a loop...

  • edited 6:32PM

    Hi,

    You're right exp.get_file works only for single files. However, if you have your filenames in a list, you can simply loop over the list, read the current file, do with it whatever you want, and proceed then to the next file.
    Of course this requires that your list contains all filenames. Creating it can be a tiresome thing to do, so you can think about naming your files in a structured way (e.g. file1,file2,file3, ...), so that you only have to loop over the first till the last number of your filepool and can create the filename on the fly (filename = file + current_number)

    Best,

    Eduard

    Buy Me A Coffee

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