# Studio

> Python API functions

### askString

Invite the user to enter a string.

```python
studio.askString(msg, defaultValue="") -> core.String
```

Parameters

| Type                             | Name         | Description         |
| -------------------------------- | ------------ | ------------------- |
| [String](./core_types.md#string) | msg          | Message to display. |
| [String](./core_types.md#string) | defaultValue | Message to display. |

Returns

| Type                             | Name | Description                     |
| -------------------------------- | ---- | ------------------------------- |
| [String](./core_types.md#string) | text | The string entered by the user. |

### askYesNo

Ask a question which need a Yes/No answer.

```python
studio.askYesNo(question, defaultValue=False) -> core.Boolean
```

Parameters

| Type                               | Name         | Description                                       |
| ---------------------------------- | ------------ | ------------------------------------------------- |
| [String](./core_types.md#string)   | question     | Question to display.                              |
| [Boolean](./core_types.md#boolean) | defaultValue | Default value (if interfactive mode is disabled). |

Returns

| Type                               | Name   | Description                           |
| ---------------------------------- | ------ | ------------------------------------- |
| [Boolean](./core_types.md#boolean) | answer | True if the user say Yes, else False. |

### choose

Invite the user to choose one value between multiple choice.

```python
studio.choose(message, values, defaultValue=0) -> core.Int
```

Parameters

| Type                                     | Name         | Description                |
| ---------------------------------------- | ------------ | -------------------------- |
| [String](./core_types.md#string)         | message      | Message to display.        |
| [StringList](./core_types.md#stringlist) | values       | Possible values to choose. |
| [Int](./core_types.md#int)               | defaultValue | Default value index.       |

Returns

| Type                       | Name   | Description                                   |
| -------------------------- | ------ | --------------------------------------------- |
| [Int](./core_types.md#int) | choice | Index of the chosen value in the values list. |

### findSelectionInTree

Expand tree to the selected occurrence.

```python
studio.findSelectionInTree()
```

### getVersion

Print the current pixyz Studio version.

```python
studio.getVersion() -> core.String
```

Returns

| Type                             | Name    | Description |
| -------------------------------- | ------- | ----------- |
| [String](./core_types.md#string) | version |             |

### setViewerProperty

Set a viewer property for the Pixyz Studio main viewer (you can list the available properties with pxz.view\.listViewerProperties()).

```python
studio.setViewerProperty(propertyName, propertyValue)
```

Parameters

| Type                             | Name          | Description |
| -------------------------------- | ------------- | ----------- |
| [String](./core_types.md#string) | propertyName  |             |
| [String](./core_types.md#string) | propertyValue |             |

### showMessage

Create a message box displaying the given text.

```python
studio.showMessage(Text)
```

Parameters

| Type                             | Name | Description      |
| -------------------------------- | ---- | ---------------- |
| [String](./core_types.md#string) | Text | Text to display. |
