psychopy.app - the PsychoPy application suite

This module contains everything needed to run and manage the wxPython PsychoPy GUI application suite (e.g., Coder, Builder and Runner).

The functions presented here provide a simple interface to the PsychoPy application instance and any frames associated with it. This interface is intended for unit testing the GUI and for developers wishing to extend it.

Overview

startApp([showSplash, testMode, safeMode])

Start the PsychoPy GUI.

quitApp()

Quit the running PsychoPy application instance.

isAppStarted()

Check if the GUI portion of PsychoPy is running.

getAppInstance()

Get a reference to the PsychoPyApp object.

getAppFrame(frameName)

Get the reference to one of PsychoPy’s application frames.

Details

psychopy.app.startApp(showSplash=True, testMode=False, safeMode=False)[source]

Start the PsychoPy GUI. This can be called only once per session. Additional calls after the app starts will have no effect.

After calling this function, you can get the handle to the created app’s PsychoPyApp instance by calling getApp().

Parameters
  • showSplash (bool) – Show the splash screen on start.

  • testMode (bool) – Must be True if creating an instance for unit testing.

  • safeMode (bool) – Start PsychoPy in safe-mode. If True, the GUI application will launch with without plugins and will use a default a configuration (planned feature, not implemented yet).

psychopy.app.quitApp()[source]

Quit the running PsychoPy application instance.

Will have no effect if startApp() has not been called previously.

psychopy.app.isAppStarted()[source]

Check if the GUI portion of PsychoPy is running.

Returns

True if the GUI is started else False.

Return type

bool

psychopy.app.getAppInstance()[source]

Get a reference to the PsychoPyApp object. This function will return None if PsychoPy has been imported as a library or the app has not been fully realized.

Returns

Handle to the application instance. Returns None if the app has not been started yet or the PsychoPy is being used without a GUI.

Return type

PsychoPyApp or None

Examples

Get the coder frame (if any):

import psychopy.app as app
coder = app.getAppInstance().coder
psychopy.app.getAppFrame(frameName)[source]

Get the reference to one of PsychoPy’s application frames. Returns None if the specified frame has not been fully realized yet or PsychoPy is not in GUI mode.

Parameters

frameName (str) – Identifier for the frame to get a reference to. Valid names are ‘coder’, ‘builder’ or ‘runner’.

Returns

Reference to the frame instance (i.e. CoderFrame, BuilderFrame or RunnerFrame). None is returned if the frame has not been created or the app is not running.

Return type

object or None


Back to top