Howdy, Stranger!

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

Supported by

Keypress duration as Sketchpad Duration

edited November 2016 in OpenSesame

Hi all,

I'm aware that my question may have a ridiculously simple answer but I'm not able to find a working solution on my own.

As the title says, I need to present a sketchpad for as long as the participant presses a key.
In other words I will present sketchpad1 and it will remain on the screen until the participant presses a key. Then, sketchpad2 will be shown until the participant releases the key. In that moment, sketchpad3 will appear for some miliseconds and then the loop will start again.

I've looked at this other related threads:

But I have not been able to get it to work.

Thanks!

Comments

  • Hi shamshir,

    set "duration" to infinite.
    put a keyboard_response item afterwards.
    http://osdoc.cogsci.nl/3.1/manual/response/keyboard/

    Greetz
    Stephan

  • Hi DahmSF,

    Thanks for answering! When I do what you mentioned, i'm not able to obtain the effect that I'm looking for. I would like to just press a key one time to go from sketchpad1 to sketchpad3. Let me explain again because now that I'm reading what I posted, it looks a bit confusing.

    I want to present a image (sketchpad1) until the participant makes a keyboard response. So, I set the duration of sketchpad1 to "0" and I put a keyboard-response afterwards. When a key is pressed (the space bar in my case), sketchpad2 will appear. During how much time? Well, as long as the participant presses the key. Then, when the participant releases the key, sketchpad2 should vanish and sketchpad3 should appear and remain in the screen for some miliseconds. Then the trial is ended and another sketchpad1 appears to begin a new one.

    I've looked in the documentation and I couldn't find any "release" key responses, but looking at the threads that I mentioned in the previous post, I've been able to construct a simple code that nearly reaches my goal. The only problems are that I just have to use sketchpad1 and sketchpad2 without the third one in order for it to work, and it skips the last trial (I guess because the loop element is over and the code only is on the loop element and not in the rest of the experiment).

    The code:

    import pygame
    stop = True
    while stop == True:
        for event in pygame.event.get():
            if event.type == pygame.KEYUP:
                stop = False
    

    Regards
    Javi

  • Hi Javi,

    Your code looks already promising. If you add the presentation of the second stimulus, you should be set. Can you try it?

        import pygame
        cv = canvas() # the second canvas
        cv3= canvas() # third canvas
        cv.circle(0,0,10,fill=True) # just some stuff that I put on the canvas for illustration purposes
        cv3.circle(0,0,30,fill=True) # just some stuff that I put on the canvas for illustration purposes
        stop = True
        while stop == True:
            for event in pygame.event.get():
                    cv.show() # show the canvas
                if event.type == pygame.KEYUP:
                    stop = False
                            cv3.show()
    

    Does this make sense?

    Eduard

    Buy Me A Coffee

  • edited January 2017

    Hi Eduard,

    Your code could totally solve my problem, but I have the 3 canvas as 3 different sketchpads with variables and such. How do I link the specific sketchpads inside my loop and not other sketchpads that have the same name, that are presented in other parts of the experiment?

    Thanks a lot for your answer!
    Regards
    Javi

  • Ok, I've "discovered" this function:

    my_canvas = self.copy_sketchpad('my_sketchpad')

    If I'm not mistaken, this lets me copy a given Sketchpad as a canvas, once it has already been prepared.

    My first question regarding this is, do I lose information like how much time a given sketchpad is supposed to be shown? If so, how do I specify the time of a canvas?

    My second question is how should I edit the sketchpads so that they are only shown when the code says? Can I set their condition on the sequence to "never" so that they are prepared but only shown like the code from Eduard specifies?

    I'm sorry if I'm missing something very obvious :sweat:
    Thanks a lot!

    Regards
    Javi

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