Search code examples
pythonmacoswindows-7windowpsychopy

How to keep PsychoPy object visual.Window the topmost (active) window on Windows 7?


I have an experiment code that opens other programs via the command line (i.e., os.startfile) and was wondering how to keep the visual.Window() object that PsychoPy creates as the topmost active window even when opening these programs. I would like these other programs to run in the background and not interfere with the participant keyboard responses to experimental stimuli. As it is now, I have to manually click on the experiment window for it to become active again when opening these other programs, and until I click on it, responses are not recorded in PsychoPy.

If you do not mind sharing how you would go about keeping the PsychoPy visual.Window() on top, I would greatly appreciate it. I am running PsychoPy v 1.81.03 on Windows 7, but would also be interested in the answer for OSX too. Thank you for sharing your knowledge and expertise!


Solution

  • So I take it that just setting the window to fullscreen doesn't do what you want?

    If not, you could force the PsychoPy window back to the front by issuing specific calls after you launch your other processes. Look into the discussion here: https://groups.google.com/d/msg/psychopy-users/G36xcfCRRcY/5RICiMU6Op4J

    But in essence, you will be using calls like this:

    win.winHandle.maximize() 
    

    or:

    win.winHandle.activate()
    

    as required.