# \[TUTORIAL\]Running Python Mode in VScode

**URL:** https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716
**Category:** Processing.py
**Created:** [January 21, 2019, 10:45pm UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716 "2019-01-21T22:45:57Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![fenjalien](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@fenjalien](https://discourse.processing.org/u/fenjalien)
#### Post date: [January 21, 2019, 10:45pm UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/1 "2019-01-21T22:45:57Z")

</div>

This is the method that I used to get processing.py sketches to run in VScode.

You will need:

- Java to be installed and added to path
- The file `processing-py.jar`
- The [Code runner](https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner#overview) extension

To get the first two items refer to the tutorial on how to run processing.py sketches on the command line [here](https://py.processing.org/tutorials/command-line/).

1. Open up a new workspace and create a python file with the processing code you want to run.  
Example code:

```auto
# mouse_follow.py
def setup():
    size(400,400)

def draw():
    background(255)
    fill(0)
    ellipse(mouseX, mouseY, 50, 50)

```

1. Add the `processing-py.jar` file in the same workspace.
2. In the `settings.json` file under WORKSPACE SETTINGS tab, add the line:

```auto
 "code-runner.customCommand": "java -jar processing-py.jar mouse_follow.py"

```

So it should look something like this:

```auto
{
    "code-runner.customCommand": "java -jar processing-py.jar mouse_follow.py"
}

```

1. Run the command `Run Custom Command` (Ctrl + Alt + K)
2. Bask in the glory of your work.

**NB:** The file `processing-py.jar` can be located anywhere just add its path to the custom command.

Let me know if you get stuck on any part of this, I will try to help you.  
No, Thankyou!

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [January 27, 2019, 2:02am UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/2 "2019-01-27T02:02:16Z")

</div>

Thank you so much for creating this!

---

<div class="post-metadata">

### Author: ![haschdl](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/haschdl/32/1082_2.png) [@haschdl](https://discourse.processing.org/u/haschdl)
#### Post date: [October 27, 2019, 12:00pm UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/3 "2019-10-27T12:00:16Z")

</div>

very nice! I’m doing a presentation about creative coding with Python and this will be very useful, thanks for sharing!

---

<div class="post-metadata">

### Author: ![haschdl](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/haschdl/32/1082_2.png) [@haschdl](https://discourse.processing.org/u/haschdl)
#### Post date: [October 28, 2019, 8:26pm UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/4 "2019-10-28T20:26:41Z")

</div>

I was wondering if anyone starting Processing from VS Code or from the command line know how to control the location of the Processing application? I’m running in two screens, and I’d like to set where the sketch will show up on the screen after launch.

---

<div class="post-metadata">

### Author: ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)
#### Post date: [November 4, 2019, 8:04pm UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/5 "2019-11-04T20:04:55Z")

</div>

I have not tested it (because I don’t have a second monitor right now), but see if `fullscreen()` would help:

[https://py.processing.org/reference/fullScreen.html](https://py.processing.org/reference/fullScreen.html)

```auto
fullScreen()
fullScreen(display)
fullScreen(renderer)
fullScreen(renderer, display)

```

Known issues: [https://github.com/jdf/processing.py/issues/346](https://github.com/jdf/processing.py/issues/346)

---

<div class="post-metadata">

### Author: ![l3ehfar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/l3ehfar/32/4074_2.png) [@l3ehfar](https://discourse.processing.org/u/l3ehfar)
#### Post date: [December 30, 2019, 4:48pm UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/6 "2019-12-30T16:48:50Z")

</div>

hi I got an error as this:

> [Running] java -jar processing-py.jar mouse\_follow.py
> 
> ‘java’ is not recognized as an internal or external command,
> 
> operable program or batch file.

and i have no idea what to do, would you help me?

---

<div class="post-metadata">

### Author: ![tabreturn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tabreturn/32/3697_2.png) [@tabreturn](https://discourse.processing.org/u/tabreturn)
#### Post date: [December 30, 2019, 7:24pm UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/7 "2019-12-30T19:24:46Z")

</div>

Have you added the Java path to your system variables?  
[https://www.java.com/en/download/help/path.xml](https://www.java.com/en/download/help/path.xml)

---

<div class="post-metadata">

### Author: ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)
#### Post date: [April 25, 2020, 2:57pm UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/8 "2020-04-25T14:57:00Z")

</div>

I’ve mentioned this thread on an issue: [https://github.com/TobiahZ/processing-vscode/issues/79](https://github.com/TobiahZ/processing-vscode/issues/79)  
So I’m linking it in case someone back here has the skills to contribute to the VS Code extension…

---

<div class="post-metadata">

### Author: ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)
#### Post date: [September 1, 2020, 8:03pm UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/9 "2020-09-01T20:03:56Z")

</div>

So … I decided to try it out 😃  
But it didn’t work for me at first 😕

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/a87bd44f28f8f44d767e58ec34d054e46a9efee1.png)

So, for me the workspace thing didn’t work, but this extension settings thing did work!  
(maybe I have the wrong extension?!?!?!)

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/1/1f89390edccd63f2cff58dc4bfbe5d0ae9759355.png)  
🙂

---

<div class="post-metadata">

### Author: ![fenjalien](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@fenjalien](https://discourse.processing.org/u/fenjalien)
#### Post date: [September 1, 2020, 8:56pm UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/10 "2020-09-01T20:56:21Z")

</div>

Hi, tbh its been so long that I don’t remember how this works.  
However since then I’ve moved onto use [p5py](https://github.com/p5py/p5) a pure python implementation of processing which means you don’t have to fiddle around with java or extensions (Although you do have to get glfw which took me a while).

After using p5py for a while I realised there was pretty slow and a lot of overhead in how it worked. So I made my own implementation built on top of [pyglet](http://pyglet.org/). I haven’t made it public yet as I got distracted by other projects but if someone wants to try it give me a push.

---

<div class="post-metadata">

### Author: ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)
#### Post date: [September 2, 2020, 8:57pm UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/11 "2020-09-02T20:57:39Z")

</div>

> [@fenjalien](#):
>
> my own implementation built on top of [pyglet](http://pyglet.org/).

How cool! I’d love to see that!

I have been dabbling with flat (a Python library) which is good for print/static/SVG stuff, but not animations/interactions.

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [September 9, 2020, 8:29pm UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/12 "2020-09-09T20:29:06Z")

</div>

> [@fenjalien](#):
>
> I made my own implementation built on top of [pyglet](http://pyglet.org/). I haven’t made it public yet as I got distracted by other projects but if someone wants to try it give me a push.

I would be very interested in seeing your pyglet implementation!

---

<div class="post-metadata">

### Author: ![fenjalien](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@fenjalien](https://discourse.processing.org/u/fenjalien)
#### Post date: [September 16, 2020, 8:44pm UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/13 "2020-09-16T20:44:11Z")

</div>

Hokay I’ve done the repo up a bit, made it public and announced it on a seperate topic. Go knock yourselves out and break it pls.

> [@Yap5 Repo Release](https://discourse.processing.org/t/yap5-repo-release/23899):
>
> Hi all, this is to announce that I have made the yap5 repository public. Its an experimental rewrite of p5py/p5 that instead uses pyglet as its graphics backend. Read the README in the repo for more details. Slight disclaimer that I’ve only tested this on windows 10 with python 3.7 so if any bugs come up please please raise an issue. this has stemmed from [this topic](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716).

> **[GitHub - fenjalien/yap5: "Yet Another p5" A slight rewrite of p5py that...](https://github.com/fenjalien/yap5)**
>
> "Yet Another p5" A slight rewrite of p5py that focuses more on the 2D side of drawing, built ontop of pyglet. - GitHub - fenjalien/yap5: "Yet Another p5" A slight rewrite of p5p...

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [September 17, 2020, 10:17pm UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/14 "2020-09-17T22:17:37Z")

</div>

Thanks for sharing this, @fenjalien! I’ve moved your announcement post into our new p5py category.

---

<div class="post-metadata">

### Author: ![Mayarch](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mayarch/32/10647_2.png) [@Mayarch](https://discourse.processing.org/u/Mayarch)
#### Post date: [September 19, 2020, 11:50pm UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/15 "2020-09-19T23:50:55Z")

</div>

how can i use igeo library([http://igeo.jp/](http://igeo.jp/)) in vs code?

---

<div class="post-metadata">

### Author: ![tabreturn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tabreturn/32/3697_2.png) [@tabreturn](https://discourse.processing.org/u/tabreturn)
#### Post date: [September 20, 2020, 12:51am UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/16 "2020-09-20T00:51:15Z")

</div>

Hi @Mayarch

If you have processing.py working in VScode (as per @fenjalien and @villares’ instructions), then you can add libraries (igeo, etc.) using these instructions: [https://py.processing.org/tutorials/command-line/#processing-libraries](https://py.processing.org/tutorials/command-line/#processing-libraries)

---

<div class="post-metadata">

### Author: ![Mayarch](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mayarch/32/10647_2.png) [@Mayarch](https://discourse.processing.org/u/Mayarch)
#### Post date: [September 20, 2020, 9:48am UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/17 "2020-09-20T09:48:32Z")

</div>

i can use processing.py in vs code as native.but when i try to use third part libraries like igeo,even if i followed the instructions in the link that u send,i couldn t success to reach i geo library in vs code.

 ![hata](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/e/e4dccddbcfceedb277f73f4d9dda5949aed31d58.png)

---

<div class="post-metadata">

### Author: ![Mayarch](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mayarch/32/10647_2.png) [@Mayarch](https://discourse.processing.org/u/Mayarch)
#### Post date: [September 20, 2020, 10:19am UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/18 "2020-09-20T10:19:55Z")

</div>

when i try to add pdf library i took that messages.

 ![hata1](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/a8f9aa9173d3b40e5dd115aa8434ea71a2cd6bac.png)

---

<div class="post-metadata">

### Author: ![tabreturn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tabreturn/32/3697_2.png) [@tabreturn](https://discourse.processing.org/u/tabreturn)
#### Post date: [September 20, 2020, 10:41am UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/19 "2020-09-20T10:41:13Z")

</div>

It seems that the command line version doesn’t include the PDF library – but you can copy this across from a standard Processing install.

I got the same iGeo errors as you, so this isn’t a VScode issue. However, I got this example working fine:

```auto
#from java.lang import System
#System.setProperty("jogl.disable.openglcore", "false")

add_library('igeo')

def setup():
    size(480, 360, IG.GL)

def draw():
    IPoint(0,0,0)
    IPoint(20,0,0)
    IPoint(20,20,0)
    IPoint(0,20,0)

```

Uncomment the first two lines for Linux.

---

<div class="post-metadata">

### Author: ![Mayarch](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mayarch/32/10647_2.png) [@Mayarch](https://discourse.processing.org/u/Mayarch)
#### Post date: [September 20, 2020, 10:47am UTC](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716/20 "2020-09-20T10:47:40Z")

</div>

one more question . is there anyway to use autocomplete for igeo command\_?

[Next page](https://discourse.processing.org/t/tutorial-running-python-mode-in-vscode/7716.md?page=2)
