Howdy, Stranger!

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

Supported by

[mac os] Sketchpads on Legacy don't work anymore

Hi,

I have a MacBook Air running on macOS Sierra 10.12.5.

I haven't used OpenSesame since a few months, i started to create a new experiment today but legacy and droid backends don't seem to work anymore.
The problem comes essentially with sketchpads. Even with a very simple experiment (2 sketchpads : a fixation dot and a blank sketchpad), the first sketchpad is not displayed.

It works fine with psycho and xpyriment backends, but it doesnt work with legacy and droid backends.

I tried with 3 different version of OpenSesame (from 2.9 to 3.1.6), same behavior. I also tried old experiments that used to run well on my computer and they don't work anymore (sequences of sketchpad aren't well displayed).

I'm guessing something is wrong with my python installation ? I recently installed Anaconda on my computer, maybe something was messed up ?

Comments

  • Hi,

    I suspect it's this issue. Essentially, in some cases on Mac OS, the display isn't refreshed unless there is also some form of keyboard interaction. Flushing the keyboard is sufficient.

    Is that what you're seeing as well? I.e. a sketchpad that is followed by a sleep and then another sketchpad is not shown. But a sketchpad that is followed by a keyboard_response is shown. Correct?

    Cheers,
    Sebastiaan

  • PadPad
    edited June 2017

    Hi @sebastiaan,
    Correct.

    I also replicated your github bug
    This also work btw :

    c = canvas()
    my_mouse = mouse()
    
    for i in range(5):
        c.clear()
        c.text(str(i))
        c.show()
        my_mouse.get_click(timeout=5)
        clock.sleep(1000)
    

    Any tip to make the sketchpads appear without having to replace them for inline_scripts ?

  • Hi,

    Below is a script that wraps the original canvas.show() by a function that first calls pygame.event.peek(), which appears to be sufficient to cause the display to be refreshed without having any side effects.

    If you put this script in the Prepare phase of an inline_script at the very start of the experiment, does this fully resolve the issue? If so, this might be something to include in the next maintenance release of OpenSesame.

    import pygame
    from openexp._canvas import legacy
    
    
    def custom_show(old_show):
    
        def inner(self):
    
            pygame.event.peek()
            return old_show(self)
    
        return inner
    
    
    legacy.legacy.show = custom_show(legacy.legacy.show)
    

    Cheers,
    Sebastiaan

  • It partialy resolves the issue. The sketchpads are displayed, but timing is messed up : a 500ms fixation dot is barely visible.

  • The sketchpads are displayed, but timing is messed up : a 500ms fixation dot is barely visible.

    Ok, thanks for trying. When I'm back at the lab (where I have a Mac) I'll take a look at this more closely.

  • Right, the interaction needs to occur after showing the canvas. Also the crucial action appears to be that the event loop is processed, not anything with the keyboard per se.

    The following hack works for me with little obvious timing glitches.

    import pygame
    from openexp._canvas import legacy
    
    
    def custom_show(old_show):
    
        def inner(self):
    
            t = old_show(self)
            pygame.event.pump()
            return t
    
        return inner
    
    
    legacy.legacy.show = custom_show(legacy.legacy.show)
    

    @Daniel What do you make of this? Is this a sensible thing to do in your opinion? If so, we can implement this as a Mac-OS specific fix to 517.

  • Yes it solved the problem thanks ! I didn't precisely checked the timings but it seems to be ok.
    Do you know exactly when and why this bug occurs ? There are some iMac on my lab that are used for experimentations. Updates are usually made during summer, i'm guessing we will have to look closely if this bug appears.

Sign In or Register to comment.