Why is my dialog not showing when fullscr = True?

I want to display a dialog box to ask an experimental participant to enter a number using a psychopath. When fullscr=Falsea win displays a dialog box. When fullscr=True, it does not appear, even if you dial the number and then return, it transfers the program to the next cycle.

Any ideas why? Relevant lines of code below.

from psychopy import visual, event, core, data, gui, logging
win = visual.Window([1024,768], fullscr=True, units='pix', autoLog=True)

respInfo={}
respInfo['duration']=''
respDlg = gui.DlgFromDict(respInfo)
+4
source share
1 answer

This is because the psychopath’s window is on top of everything else when fullscr=True, therefore, in your example, a dialog box is created but not displayed to the user, since the window is on top.

Present dialog box at the beginning

, : :

# Import stuff
from psychopy import visual, gui

# Show dialogue box
respInfo={'duration': ''}
respDlg = gui.DlgFromDict(respInfo)

# Initiate window
win = visual.Window(fullscr=True)

, .

  • ,
  • ( , ).
  • ( 2
  • , . , ( ) .

, :

# Import stuff, create a window and a stimulus
from psychopy import visual, event, gui
win1 = visual.Window(fullscr=True)
stim = visual.TextStim(win1)  # create stimulus in win1

# Present the stimulus in window 1
stim.draw()
win1.flip()
event.waitKeys()

# Present dialogue box
win_background = visual.Window(fullscr=False, size=[5000, 5000], allowGUI=False)  # optional: a temporary big window to hide the desktop/app to the participant
win1.close()  # close window 1
respDict = {'duration':''}
gui.DlgFromDict(respDict)
win_background.close()  # clean up the temporary background  

# Create a new window and prepare the stimulus
win2 = visual.Window(fullscr=True)
stim.win = win2  # important: set the stimulus to the new window.
stim.text = 'entered duration:' + respDict['duration']  # show what was entered

# Show it!
stim.draw()
win2.flip()
event.waitKeys() 
+3

All Articles