# Desktop Environment

If you're already an experienced roboticist and developer you can program Misty by setting up your own desktop environment and code editor. There you can program Misty using Python, C# or JavaScript. While you can do most of your programming in Misty Studio, for more complex programs that require external dependencies you may need to use your preferred code editor.

## Setting up a desktop environment for Python in Windows

### Step 1.  Power on Misty

Misty has to be powered on and connected to your WIFI network in order to receive commands.

### Step 1. Download your code editor and program packages

In order to start setting a desktop environment to program Misty in Python you will need to download a code editor, a Python installer and the Misty Python SDK package. For your code editor you can use Visual Studio Code or any other Python editor.

* [Download Visual Studio Code](https://code.visualstudio.com/download)
* [Download Python Installer](https://www.python.org/downloads/)
* [Download Misty Python SDK](https://github.com/MistyCommunity/Python-SDK)

### Step 3. Set up a Path

Once you've installed Visual Studio Code and Python on your computer, you will need to create a working directory where you can extract the Misty Python SDK package zip file. The extracted contents can be place in any folder on your desktop. (For example C:\Users\YourName\Desktop\ MistyPythonSDK) Now to be able to put the code editor, Python and the Misty SDK in same desktop environment and establish a working path, you will need to search and open  'Edit the system environment variables' function in the Windows Search Bar. You will see window called System Properties,  click on the button called Environment Variables.

<figure><img src="/files/wSl17H0V3Y0klKVDJCBs" alt="" width="302"><figcaption></figcaption></figure>

After you open the environment variables windows you will see a section with a list of folders, choose 'Path' and click on the button 'Edit'.

<figure><img src="/files/7HF7cgpnVPkQNyRsuekZ" alt="" width="375"><figcaption></figcaption></figure>

Inside the path folder you will need to add all the folders paths that contain your code editor and python executables, as well as python packages and the working directory with the Misty Python SDK.

<figure><img src="/files/8tdIU8fU5TKmPeRqQaFS" alt="" width="370"><figcaption></figcaption></figure>

### Step 4. Install Dependencies

In your Visual Studio Code you will need to set your working directory as the default directory for the terminal. This can be done in settings by searching "terminal.integrated.cwd" and writing in the folder path of the working directory.  Now you can navigate back to your terminal and install the following dependencies. Place them in your terminal and press Enter. In some case you will need to install additional dependencies if you want to use more Python libraries. Visual Studio Code will highlight the lines of code that need additional dependencies to work, by hovering over the line you can use 'Quick Fix' to find the dependency you need.

```python
pip install 'requests>=2.25.1'
pip install 'websocket-client<=0.57.0'
pip install 'yapf>=0.30.0'
```

<figure><img src="/files/DjXEd0ccTBW5PsjULuoH" alt=""><figcaption></figcaption></figure>

### Step 5. Create Robot Generator

To be able to connect to Misty via her IP address and use the API endpoints you will need to create a Python file in your working directory called `update.py` . Save the file and run it using the command python update.py in your terminal.&#x20;

```python
from mistyPy.GenerateRobot import RobotGenerator
RobotGenerator("ROBOT-IP_ADDRESS-GOES-HERE")
```

<figure><img src="/files/tsLJGBolJ16c3p23yfyi" alt=""><figcaption></figcaption></figure>

### Step 6. Create your Python Project

Congratulations! You have now set up your desktop environment for Misty. You can now create a Python project and start programming Misty. Remember to keep your project file in the same folder path as your Misty Python SDK. You can run your program by using the run button in the top right corner and cancel your program by deleting the terminal session or pressing Control + C.

<figure><img src="/files/9S5gMVVkShV8KnIrgewO" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lessons.mistyrobotics.com/misty-lessons/desktop-environment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
