Keyboard interaction required to refresh display on Mac OS with legacy backend
I've noticed the following strange problem. (This may or may not be related to #481.)
On my Mac OS system, presenting canvas objects with only a sleep in between prevents the canvas from being shown. So the following code doesn't show anything on the display:
c = canvas()
k = keyboard()
for i in range(5):
c.clear()
c.text(str(i))
c.show()
clock.sleep(1000)
However, as soon as there is some keyboard interaction after the canvas is shown, the display is refreshed. So the following code works fine:
c = canvas()
k = keyboard()
for i in range(5):
c.clear()
c.text(str(i))
c.show()
k.flush() # This 'fixes' the problem
clock.sleep(1000)
This issue appears to be specific to the combination of Mac OS and the legacy backend. @dschreij, any thoughts?
My system:
- Mac OS Sierra
- OpenSesame 3.1.6-py2.7-2
Yes, this is definitely related to https://github.com/smathot/OpenSesame/issues/481. I've already already thoroughly looked at this problem and can't really see anything wrong in OpenSesame's code. This problem is quite recent and only started occurring since a few versions ago (can't really recall which one). Before that, legacy always worked fine on MacOS.
Since the psychopy and expyriment backends don't show this problem, it must be a pygame one. Maybe we should write a simple test-case in pure pygame to see if it shows the same behavior. That way we can determine if the problem should be found in OpenSesame or is a pure pygame one.
It's sad that pygame is starting to perform so badly on MacOS, but on the bright side, it finally went from 1.9.2alpha to 1.9.3, so maybe they are actively developing it again...
According to the discussion below, this issue still (or again) arises:
- http://forum.cogsci.nl/discussion/comment/14504#Comment_14504
Dear developers, @dschreij , The problem still (or again) occurs with Version 3.3.5. The workaround with kb.flush before clock.sleep() still works fine, but is a little akward. ;) I've been using Xpyriment backend, not legacy as the title says. It occurs on Mac, but not on Windows. Stephan
Hi Stephan. Thanks for reporting this again. I don't really have the opportunity to look at this at this time, but we'll keep it on our radar if we work on the bugfixes again.
@smathot. Should we reopen this issue?