Howdy, Stranger!

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

Supported by

Mousetrap: stimuli image not showing

edited April 2018 in Mousetrap

Hi everybody,

I have ran into a problem with my mouse tracking experiment.
Sometimes the stimuli (images) do not show. This happens at random trial numbers.
I have made buttons the size of the stimuli. When the stimuli do not show, you see a blank screen.
However, when you click the (invisible) buttons, so where the stimuli are supposed to be, you continue to the next trial and then the stimuli are visible again.

In a previous version of the experiment this problem does not occur. The only difference between the two experiments is that in the working one the mouse is not visible in a trial with a visual analogue scale and in the defective one the mouse is visible.

These are the scripts for these visual analogue scales:

Working experiment:
# import everything we need
from openexp.canvas import canvas
from openexp.mouse import mouse

    # create the instances we need
    my_canvas = canvas(self.experiment)
    my_mouse = mouse(self.experiment, timeout=1)

    # slider dimensions
    slider_w = 500
    slider_h = 10
    slider_x = -slider_w/2
    slider_y = -slider_h/2

    # draw some text (this can be anything)
    my_canvas.text("To what extent were your thoughts focused on or off the task just before this moment?<br><br>Please indicate a percentage where 100% indicates completely on-task and 0% completely off-task.", y=slider_y-200, font_size=30)
    #draw options
    my_canvas.text("0%<br>(Completely off-task)", y= slider_y+50, x= -250, )
    my_canvas.text("100%<br>(Completely on-task)", y= slider_y+50, x= 250)
    # draw the slider frame
    my_canvas.rect(slider_x, slider_y, slider_w, slider_h)
    # add a text below the bottom slider, telling participants to click to accept
    my_canvas.text("Click your mouse to accept ...", y=slider_y+200) 

    # keep showing the interactive slider until a click has been made
    clicked = False
    while not clicked:

        # determine the slider fill based on the mouse position
        pos, time = my_mouse.get_pos()
        x, y = pos
        slider_fill = min(slider_w, max(0, x-slider_x))
            # draw an empty rect within the slider frame, effectively resetting it
        my_canvas.rect(slider_x, slider_y, slider_w, slider_h, fill=True, color=self.get("background"))
            # draw the slider fill
        my_canvas.rect(slider_x, slider_y, slider_fill, slider_h, fill=True)
            # show the updated canvas
        my_canvas.show()
        # Poll the mouse for buttonclicks
        button, position, timestamp = my_mouse.get_click(timeout = 1)
        if button != None:
            clicked = True

    # save the slider's filling
    slider_percent = 100.0*slider_fill/slider_w  
    exp.set("slider_percent", slider_percent)

Defective experiment:
my_canvas = canvas()
my_mouse = mouse(timeout=1)
my_mouse.show_cursor(True)
# Set slider dimensions. This assumes that 0,0 is the display center, which is
# the default in OpenSesame >= 3.
slider_w = 500
slider_h = 10
slider_x = -slider_w/2
slider_y = -slider_h/2
my_canvas.text("To what extent were your thought’s focused on or off the task just before this moment?", y=slider_y-200, font_size=30)
my_canvas.text("Click your mouse to accept ...", y=slider_y+200)
my_canvas.text("Completely off-task", y= slider_y+30, x= -350)
my_canvas.text("Completely on-task", y= slider_y+30, x= 350)
# Draw the slider frame
my_canvas.rect(slider_x, slider_y, slider_w, slider_h)
lifeCanvas = canvas()
while True:

                                # Determine the slider fill based on the mouse position
                                pos, time = my_mouse.get_pos()
                                x, y = pos
                                slider_fill = min(slider_w, max(0, x-slider_x))

                                lifeCanvas.clear()
                                my_mouse.set_visible()

                                lifeCanvas.copy(my_canvas)
                                # Draw some text (this can be anything)


                                # Draw the slider fill
                                lifeCanvas.rect(slider_x, slider_y, slider_fill, slider_h, fill=True)                
                                # Draw the mouse cursor
                                lifeCanvas.show()

                                # Poll the mouse for buttonclicks
                                button, position, timestamp = my_mouse.get_click()
                                if button is not None:
                                    break

                            # Set the slider response as an experimental variable
                            var.slider_percent = 100.0*slider_fill/slider_w 

I hope someone can help me with this.

Best,

Dirk

Comments

  • Hi Dirk,
    I would like to help with this problem, but I think that it would be easier to test if you could provide a demo version of the working experiment and a demo of the defective expriment (not just the slider code). Besides, have you tested both experiments with the same version of OpenSesame and mousetrap?
    Best,
    Pascal

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