psychopy.org | Reference | Downloads | Github

Bug: User-defined GUI does not display in full screen on Mac OSX

I have an experiment that requires a secondary GUI to input information after the inital “participant/session” GUI. I’m running this on a Mac OSX El Capitan (10.11.6). If I uncheck “full screen” in the settings, it displays fine. If it’s full screen, it’s clear that the gui is being displayed behind the window. A small example is below. By simply changing fullscr to True or False you can see that it won’t display. I haven’t had a chance to test on other platforms.

I suppose the alternative is to insert the GUI code before calling visual.Window in the coder view, but this is not ideal because this is a project I’m handing off to someone else, and I’m trying to build the whole thing in Builder. Perhaps there’s another workaround I’m not aware of?

Thanks!
Jason

Example:


# Setup the Window
#when fullscr = True, GUI doesn't show. Change to False and it will
win = visual.Window(
    size=(1440, 900), fullscr=True, screen=0,
    allowGUI=True, allowStencil=False,
    monitor=u'testMonitor', color=[0,0,0], colorSpace='rgb',
    blendMode='avg', useFBO=True)

trialClock = core.Clock()
t = 0
trialClock.reset()  # clock

while True:
    # get current time
    t = trialClock.getTime()
    
    #show gui after 500ms
    if t>.5:
        
        dlg2 = gui.Dlg(title='a second gui',screen=0)
        dlg2.addField('enter a number:',0,tip='just enter a number')
        ok_data = dlg2.show()
        if dlg2.OK:
            core.wait(.5)
            break
            
    # check for quit (the Esc key)
    if event.getKeys(keyList=["escape"]):
        core.quit()
    
    # refresh the screen
    win.flip()

win.close()
core.quit()

This isn’t a bug. A full-screen window by definition hogs the entire interface and prevents interaction with any other window. You will need to actively minimise your main window in order for the dialog to be visible and usable, and then activate it again afterwards.

Try reading the entirety of this thread, including the link in the last post from me:

1 Like

Ok that does make sense regarding the full screen.

Your solution (the one posted on stack overflow) suggested this:

win.fullscr=False
win.winHandle.minimize()
win.flip()

#do all the GUI stuff

win.winHandle.maximize()
win.winHandle.activate()
win.fullscr = True
win.flip()

and it almost works. The minimizing/maximizing works great. However, the win.fullscr = True/False line doesn’t seem to have an effect. The full screen mode that’s set in the experiment settings is what it will stay on. Any thoughts?

Thanks!

I think I answered my own question. After digging a little in the pyglet documentation (http://pyglet.readthedocs.io/en/pyglet-1.2-maintenance/programming_guide/windowing.html#fullscreen-windows) I found the function set_fullscreen. If I’m understanding correctly, win.winHandle is the actual pyglet window object, correct? So now I start with a fullscreen window, then do:

win.fullscr = False           #not sure if this is necessary
win.winHandle.set_fullscreen(False)
win.winHandle.minimize()
win.flip()

#do GUI stuff....

win.winHandle.maximize()
win.winHandle.activate()
win.fullscr=True
win.winHandle.set_fullscreen(True)
win.flip()

2 Likes

This works for me, but not when the Show mouse is set to false in the Experiment Settings. Maybe there’s a way to make he mouse hidden after the GUI stuff?