# JSDoc: Class: GUI

# Class: GUI

## core.GUI(psychoJS)

Graphic User Interface

## Constructor

#### new GUI(psychoJS)

##### Parameters:

Name | Type | Description
--- | --- | ---
`psychoJS` | module:core.PsychoJS | the PsychoJS instance

Source:
  - core/GUI.js, line 19

### Members

#### (readonly) dialogMargin :Symbol

Dialog window margins.

##### Type:

- Symbol

Source:
  - core/GUI.js, line 717

#### (readonly) dialogMaxSize :Symbol

Maximal dimensions of the dialog window.

##### Type:

- Symbol

Source:
  - core/GUI.js, line 707

### Methods

#### closeDialog()

Close the previously opened dialog box, if there is one.

Source:
  - core/GUI.js, line 445

#### dialog(options)

Show a message to the participant in a dialog box.

This function can be used to display both warning and error messages.

##### Parameters:

Name | Type | Description
--- | --- | ---

`options`

Object

###### Properties

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`message` | string |  |  | the message to be displayed
`error` | Object.<string, *> |  |  | an exception
`warning` | string |  |  | a warning message
`showOK` | boolean | <optional> | true | specifies whether to show the OK button
`onOK` | GUI.onOK | <optional> |  | function called when the participant presses the OK button

Source:
  - core/GUI.js, line 304

#### DlgFromDict(options)

Create a dialog box that (a) enables the participant to set some experimental values (e.g. the session name), (b) shows progress of resource download, and (c) enables the participant to cancel the experiment.

Setting experiment values

DlgFromDict displays an input field for all values in the dictionary. It is possible to specify default values e.g.:

`let expName = 'stroop';
let expInfo = {'participant':'', 'session':'01'};
psychoJS.schedule(psychoJS.gui.DlgFromDict({dictionary: expInfo, title: expName}));`

If the participant cancels (by pressing Cancel or by closing the dialog box), then the dictionary remains unchanged.

##### Parameters:

Name | Type | Description
--- | --- | ---

`options`

Object

###### Properties

Name | Type | Attributes | Description
--- | --- | --- | ---
`logoUrl` | String | <optional> | Url of the experiment logo
`text` | String | <optional> | information text
`dictionary` | Object |  | associative array of values for the participant to set
`title` | String |  | name of the project

Source:
  - core/GUI.js, line 47