# Display and LED

This section contains all of Misty's APIs related to changing the display and LED.

### **DisplayImage**

Displays an image on Misty's screen. You can use this command to display images from Misty's local storage or to display images that are hosted on the web.

**Example Code**

{% hint style="success" %}

```python
misty.display_image("e_Joy.jpg",1)
```

{% endhint %}

Misty uses the default image layer settings the first time she draws content with the `DisplayImage` command. You can use the `SetImageDisplaySettings` command to adjust the settings and change the appearance for a specific image layer. Issuing a `SetImageDisplaySettings` command redraws the updated image layer on Misty's display.&#x20;

**Parameters**

{% code overflow="wrap" %}

```python
misty.display_image(self, fileName : str = None, alpha : float = None, layer : str = None, isURL : bool = None)
```

{% endcode %}

* FileName (string) - Filename for the image to display. Valid image file types are `.jpg`, `.jpeg`, `.gif`, `.png`. Alternately, if `IsUrl` is true, the URL path for the image to display.
* Alpha (double) - Optional. Opacity for the layer on which the image displays. A value of 0 is completely transparent; 1 is completely opaque. When you specify a value greater than 0 and less than 1, the layer appears but is transparent. Defaults to 1.
* Layer (string) - Optional. The display layer to create or update with this command. If `null` or not supplied, the image displays on the default image layer (named `DefaultImageLayer`).
* IsUrl (boolean) - Optional. If `true`, the system treats the string you pass in for `FileName` as the URL address for an image hosted online.

### **DisplayText**

Misty uses the default text layer settings the first time she draws content with the `DisplayText` command. You can use the `SetTextDisplaySettings` command to adjust the settings and change the appearance for a specific text layer. Issuing a `SetTextDisplaySettings` command redraws the updated image layer on Misty's display.

**Example Code**

{% hint style="success" %}

```python
misty.display_text("Hello world, my name is Misty")
```

{% endhint %}

**Parameters**

```python
misty.display_text(self, text : str = None, layer : str = None)
```

* Text (string) - The text to display.
* Layer (string) - Optional. The layer on which to display the text. You can use this parameter to create a new text layer or to update an existing text layer. If not supplied, the text displays on the default text layer (named `DefaultTextLayer`).

### **DisplayVideo**

Plays a video on Misty's screen.You can use this command to play videos you upload to Misty or videos that are hosted on the web. Use the `SaveVideo` command to upload a new video asset to your robot.

**Example Code**

{% hint style="success" %}

```python
misty.display_video("MyHomeVideo.mp4")
```

{% endhint %}

Misty uses the default video layer settings the first time she draws content with the `DisplayVideo` command. You can use the `SetVideoDisplaySettings` command to adjust the settings and change the appearance for a specific video layer. Issuing a `SetVideoDisplaySettings` command redraws the updated video layer on Misty's display.

The `DisplayVideo` command has the following limitations at this time:

* You cannot use the `DisplayVideo` command to play video recordings that Misty creates with the `StartRecordingVideo` command. Misty can only play user-uploaded videos on her display.
* Misty does not play audio for the videos she plays on her display.

**Parameters**

{% code overflow="wrap" %}

```python
misty.display_video(self, filename : str = None, layer : str = None, isURL : bool = None)
```

{% endcode %}

* FileName (string) - Filename for the video to play, with the file type extension. Valid video file types are .`mp4` and `.wmv`. Alternatively, if `IsURL` is `true`, the URL path for the video to play.
* Layer (string) - Optional. The display layer to create or update with this command. If `null` or not supplied, the video plays on the default video layer (named `DefaultVideoLayer`).
* IsUrl (boolean) - Optional. If `true`, the system treats the string you pass in for `FileName` as the URL address for a video hosted online.

### **DisplayWebView**

Misty uses the default webview layer settings the first time she draws content with the `DisplayWebView` command. You can use the `SetWebViewDisplaySettings` command to adjust the settings and change the appearance for a specific webview layer. Issuing a `SetWebViewDisplaySettings` command redraws the updated webview layer on Misty's display.

**Example Code**

{% hint style="success" %}

```python
misty.display_web_view("https://www.youtube.com/")
```

{% endhint %}

**Important!** Displaying webviews can consume a lot of computational resources. If you notice Misty's performance decrease while multiple webviews layers are active, you may consider deleting one or more webview layers.

**Parameters**

{% code overflow="wrap" %}

```python
misty.display_web_view(self, url : str = None, layer : str = None)
```

{% endcode %}

* URL (string) - The URL for the web page to display.
* Layer (string) - Optional. The display layer to create or update with this command. If `null` or not supplied, the webview displays on the default webview layer (named `DefaultWebViewLayer`).

### **ChangeLED**

Changes the color of the LED light behind the logo on Misty's torso.

**Example Code**

{% hint style="success" %}

```python
misty.change_led(125, 80, 30)
```

{% endhint %}

**Parameters**

{% code overflow="wrap" %}

```python
misty.change_led(self, red : bytes = None, green : bytes = None, blue : bytes = None)
```

{% endcode %}

* Red (byte) - The red RGB color value (range 0 to 255).
* Green (byte) - The green RGB color value (range 0 to 255).
* Blue (byte) - The blue RGB color value (range 0 to 255).

### **TransitionLED**

Sets Misty's LED to transition between two colors. When you use this command, Misty will continue the transition you specify until she is powered off or receives another command to change or transition her LED.

**Example Code**

{% hint style="success" %}

```python
misty.transition_led(200,24,0,100,80,30,"Breathe",500)
```

{% endhint %}

**Parameters**

{% code overflow="wrap" %}

```python
misty.transition_led(self, red : bytes = None, green : bytes = None, blue : bytes = None, red2 : bytes = None, green2 : bytes = None, blue2 : bytes = None, transitionType : str = None, timeMs : float = None)
```

{% endcode %}

* Red (byte) - The red RGB color value for the first color (range 0 to 255).
* Green (byte) - The green RGB color value for the first color (range 0 to 255).
* Blue (byte) - The blue RGB color value for the first color (range 0 to 255).
* Red2 (byte) - The red RGB color value for the second color (range 0 to 255).
* Green2 (byte) - The green RGB color value for the first color (range 0 to 255).
* Blue2 (byte) - The blue RGB color value for the first color (range 0 to 255).
* TransitionType (string) - The transition type to use. Case sensitive. Accepts `Blink` (continuously blinks LED between the specified colors), `Breathe` (continuously fades LED between the specified colors), and `TransitOnce` (blinks LED from first color to second color only once).
* TimeMs (int) - The duration (in milliseconds) between each transition. Must be greater than `3`.
