# Processing.py

**URL:** https://discourse.processing.org/c/processing-py/9.md?page=7

[Latest](https://discourse.processing.org/latest.md) · [Categories](https://discourse.processing.org/categories.md) · [Tags](https://discourse.processing.org/tags.md)

**Page:** 8

---

## [Sizing the display window to fit image dimensions](https://discourse.processing.org/t/sizing-the-display-window-to-fit-image-dimensions/26598)

<div class="topic-metadata">

**Author:** [@javagar](https://discourse.processing.org/u/javagar)\
**Replies:** 8\
**Last updated:** [December 30, 2020, 12:18am UTC](https://discourse.processing.org/t/sizing-the-display-window-to-fit-image-dimensions/26598 "2020-12-30T00:18:25Z")

</div>

I’d like to load an image, then size() the display window to fit the actual width and height of the image, using a technique that is considered acceptable according to Processing.py standards. But I have only been able t…

---

## [Learning python](https://discourse.processing.org/t/learning-python/26492)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 8\
**Last updated:** [December 25, 2020, 8:04pm UTC](https://discourse.processing.org/t/learning-python/26492 "2020-12-25T20:04:15Z")

</div>

Hi! I decided to learn python! Is Processing.py a viable learning tool? How hard is it to switch from processing.py to normal python? Is it recommended? Are there any resources for learning python? Could I use processi…

---

## [Themidibus + python](https://discourse.processing.org/t/themidibus-python/10382)

<div class="topic-metadata">

**Author:** [@lnp](https://discourse.processing.org/u/lnp)\
**Replies:** 5\
**Last updated:** [December 24, 2020, 3:13pm UTC](https://discourse.processing.org/t/themidibus-python/10382 "2020-12-24T15:13:43Z")

</div>

Hi everyone — I converted this java sample of themidibus in to python: https://github.com/sparks/themidibus/blob/master/examples/Basic/Basic.pde I first made sure it worked with my midi device connected and responded i…

---

## [\[Processing / Python Mode\] Lagging when calculate and render every 60 frame per second](https://discourse.processing.org/t/processing-python-mode-lagging-when-calculate-and-render-every-60-frame-per-second/26451)

<div class="topic-metadata">

**Author:** [@XiFlashlight](https://discourse.processing.org/u/XiFlashlight)\
**Replies:** 1\
**Last updated:** [December 23, 2020, 8:14pm UTC](https://discourse.processing.org/t/processing-python-mode-lagging-when-calculate-and-render-every-60-frame-per-second/26451 "2020-12-23T20:14:04Z")

</div>

Hello there, I am recently started using Processing. I tried to make a line graph visualization, but when I play, The screen goes laggy, without CPU or memory pushing the limit It goes laggier and laggier when it tries …

---

## [In Python mode, p5js.svg logo image displays strangely](https://discourse.processing.org/t/in-python-mode-p5js-svg-logo-image-displays-strangely/26355)

<div class="topic-metadata">

**Author:** [@javagar](https://discourse.processing.org/u/javagar)\
**Replies:** 2\
**Last updated:** [December 18, 2020, 2:25am UTC](https://discourse.processing.org/t/in-python-mode-p5js-svg-logo-image-displays-strangely/26355 "2020-12-18T02:25:01Z")

</div>

I had been experimenting with the p5.js logo, downloaded from the upper left corner of their home page, and it appeared perfectly in the browser, when rendered with p5.js code. I then decided to experiment with the same …

---

## [Moving background as player moves](https://discourse.processing.org/t/moving-background-as-player-moves/25854)

<div class="topic-metadata">

**Author:** [@millionish](https://discourse.processing.org/u/millionish)\
**Replies:** 21\
**Last updated:** [December 9, 2020, 6:39pm UTC](https://discourse.processing.org/t/moving-background-as-player-moves/25854 "2020-12-09T18:39:15Z")

</div>

I am making a 2D top-down shooter game similar to Hotline Miami. I want the background to move as player moves (zoomed in). How do I do this? As of now, I’ve coded only the player movement part without background. Samp…

---

## [How to turn color from get() function into an RGB value](https://discourse.processing.org/t/how-to-turn-color-from-get-function-into-an-rgb-value/25908)

<div class="topic-metadata">

**Author:** [@perrywinkle](https://discourse.processing.org/u/perrywinkle)\
**Replies:** 2\
**Last updated:** [December 2, 2020, 11:41pm UTC](https://discourse.processing.org/t/how-to-turn-color-from-get-function-into-an-rgb-value/25908 "2020-12-02T23:41:28Z")

</div>

I’m having the user pick a color to use in a generated artwork by clicking on a point on an image of a color wheel. This is my code: def mousePressed(): if pick\_color: c = get(mouseX, mouseY) print© pick\_color = Fal…

---

## [Move the box with keyboard and mouse](https://discourse.processing.org/t/move-the-box-with-keyboard-and-mouse/25824)

<div class="topic-metadata">

**Author:** [@millionish](https://discourse.processing.org/u/millionish)\
**Replies:** 9\
**Last updated:** [December 2, 2020, 10:01am UTC](https://discourse.processing.org/t/move-the-box-with-keyboard-and-mouse/25824 "2020-12-02T10:01:32Z")

</div>

I want to move the box using W,A,S,D keys and rotate the box in mouse direction (even while moving). Below is the code I’ve written but it isn’t working properly (haven’t yet implemented the mouse functionality). x = 10…

---

## [Back button not working in processing program](https://discourse.processing.org/t/back-button-not-working-in-processing-program/25823)

<div class="topic-metadata">

**Author:** [@millionish](https://discourse.processing.org/u/millionish)\
**Replies:** 5\
**Last updated:** [November 30, 2020, 10:10am UTC](https://discourse.processing.org/t/back-button-not-working-in-processing-program/25823 "2020-11-30T10:10:10Z")

</div>

Hello, I want to implement a back button functionality in my program. When I click on the start button, it takes it to another screen but when I click on the back button, nothing happens. Below is the simplified code: d…

---

## [Need help with setting up Random Walker (Coding Train)](https://discourse.processing.org/t/need-help-with-setting-up-random-walker-coding-train/25715)

<div class="topic-metadata">

**Author:** [@Epsilon](https://discourse.processing.org/u/Epsilon)\
**Replies:** 2\
**Last updated:** [November 27, 2020, 2:07pm UTC](https://discourse.processing.org/t/need-help-with-setting-up-random-walker-coding-train/25715 "2020-11-27T14:07:10Z")

</div>

Hello everyone, I’m a newcomer to Processing.py and I’ve been trying to follow the Nature of Code videos. They revolve around a subject I am very interested in, coming from 3D modelling and motion graphics I’ve been t…

---

## [Pedestrian behavior simulation](https://discourse.processing.org/t/pedestrian-behavior-simulation/25588)

<div class="topic-metadata">

**Author:** [@emyou](https://discourse.processing.org/u/emyou)\
**Replies:** 5\
**Last updated:** [November 22, 2020, 11:46pm UTC](https://discourse.processing.org/t/pedestrian-behavior-simulation/25588 "2020-11-22T23:46:43Z")

</div>

Hi, I have a project to simulate the pedestrian behavior based on the social force model. I have started with creating the pedestrian class. the pedestrian behavior is controlled by certain forces, accelerate toward targ…

---

## [Replace the current text with new text](https://discourse.processing.org/t/replace-the-current-text-with-new-text/25565)

<div class="topic-metadata">

**Author:** [@cornedb2](https://discourse.processing.org/u/cornedb2)\
**Replies:** 2\
**Last updated:** [November 20, 2020, 7:47pm UTC](https://discourse.processing.org/t/replace-the-current-text-with-new-text/25565 "2020-11-20T19:47:50Z")

</div>

Hello, How can I update the current text in the text(), now every time it will make a new text() element. Code: x = 0 def setup(): size(500, 500) def draw(): global x text(str(x), 10, 10) x += 1

---

## [Can't access subfolder's in a processing project](https://discourse.processing.org/t/cant-access-subfolders-in-a-processing-project/25527)

<div class="topic-metadata">

**Author:** [@cornedb2](https://discourse.processing.org/u/cornedb2)\
**Replies:** 2\
**Last updated:** [November 20, 2020, 2:10am UTC](https://discourse.processing.org/t/cant-access-subfolders-in-a-processing-project/25527 "2020-11-20T02:10:10Z")

</div>

Hello, I’m new to processing with Python and I want to access subfolders in my data folder with my processing project. If I loop through the folders with os.listdir(), only see the main.pyde. I’ve already tried dataPath…

---

## [Exporting 3D to SVG](https://discourse.processing.org/t/exporting-3d-to-svg/25102)

<div class="topic-metadata">

**Author:** [@slashwreck](https://discourse.processing.org/u/slashwreck)\
**Replies:** 7\
**Last updated:** [November 15, 2020, 8:44pm UTC](https://discourse.processing.org/t/exporting-3d-to-svg/25102 "2020-11-15T20:44:56Z")

</div>

I have some code snippets that allow me to export normal 2d drawings to svg output. Today I made a simple 3d drawing. I want to flatten and export it to an svg. I tried using my 2d boilerplate but it doesn’t work. W…

---

## [Alternative (beginner) way to write this code?](https://discourse.processing.org/t/alternative-beginner-way-to-write-this-code/25298)

<div class="topic-metadata">

**Author:** [@millionish](https://discourse.processing.org/u/millionish)\
**Replies:** 5\
**Last updated:** [November 10, 2020, 10:36am UTC](https://discourse.processing.org/t/alternative-beginner-way-to-write-this-code/25298 "2020-11-10T10:36:49Z")

</div>

How do I write the code (below) in an alternative (beginner) way? I don’t wish to use createShape, setFill and addChild. Instead, any other way to perform the same thing? grid = createShape(GROUP) for i in range(C\*R): …

---

## [Consecutive same](https://discourse.processing.org/t/consecutive-same/25255)

<div class="topic-metadata">

**Author:** [@millionish](https://discourse.processing.org/u/millionish)\
**Replies:** 1\
**Last updated:** [November 7, 2020, 6:56pm UTC](https://discourse.processing.org/t/consecutive-same/25255 "2020-11-07T18:56:57Z")

</div>

consecutive same consecutive same consecutive same

---

## [Generate random](https://discourse.processing.org/t/generate-random/25235)

<div class="topic-metadata">

**Author:** [@millionish](https://discourse.processing.org/u/millionish)\
**Replies:** 10\
**Last updated:** [November 7, 2020, 11:07pm UTC](https://discourse.processing.org/t/generate-random/25235 "2020-11-07T23:07:37Z")

</div>

My code as of now is as below: width = 200 class G:

---

## [Drawing, duplicating wireframe](https://discourse.processing.org/t/drawing-duplicating-wireframe/25099)

<div class="topic-metadata">

**Author:** [@slashwreck](https://discourse.processing.org/u/slashwreck)\
**Replies:** 4\
**Last updated:** [November 5, 2020, 9:05am UTC](https://discourse.processing.org/t/drawing-duplicating-wireframe/25099 "2020-11-05T09:05:03Z")

</div>

I want to draw an arbitrary number of wireframe cubes over each top of each other. I’ll do this in processing python mode. I’m wondering what the most ‘pythonic’ way to do this is. I suspect at the very least, I mak…

---

## [Problem updating list on click](https://discourse.processing.org/t/problem-updating-list-on-click/25175)

<div class="topic-metadata">

**Author:** [@solub](https://discourse.processing.org/u/solub)\
**Replies:** 1\
**Last updated:** [November 4, 2020, 3:52pm UTC](https://discourse.processing.org/t/problem-updating-list-on-click/25175 "2020-11-04T15:52:09Z")

</div>

Hi, I would like to update a list of node objects (rendered as ellipses) every time the mouse is clicked. The problem is that when mouseClicked is invoked , the grow() method appends an infinite amount of new nodes to …

---

## [I need a little help on python](https://discourse.processing.org/t/i-need-a-little-help-on-python/25118)

<div class="topic-metadata">

**Author:** [@Lorenzo](https://discourse.processing.org/u/Lorenzo)\
**Replies:** 2\
**Last updated:** [November 1, 2020, 6:01pm UTC](https://discourse.processing.org/t/i-need-a-little-help-on-python/25118 "2020-11-01T18:01:02Z")

</div>

Hello I’m looking for how to use the enter key instead of the e key in this program. if keyPressed == True: if key==“e”: ent=1 Thank you in advance for your reply

---

## [Friendly reminder: don't use sketchPath() before setup()!](https://discourse.processing.org/t/friendly-reminder-dont-use-sketchpath-before-setup/24994)

<div class="topic-metadata">

**Author:** [@villares](https://discourse.processing.org/u/villares)\
**Replies:** 0\
**Last updated:** [October 29, 2020, 2:14am UTC](https://discourse.processing.org/t/friendly-reminder-dont-use-sketchpath-before-setup/24994 "2020-10-29T02:14:07Z")

</div>

I always forget this, then I get desperate searching the forums and thinking I must be doing something wrong, and looking at older sketches where it worked just fine, jut to realize this: print(sketchPath('data')) # wr…

---

## [I need help solving this strange variable scope error](https://discourse.processing.org/t/i-need-help-solving-this-strange-variable-scope-error/24929)

<div class="topic-metadata">

**Author:** [@monster\_master10](https://discourse.processing.org/u/monster_master10)\
**Replies:** 2\
**Last updated:** [October 26, 2020, 6:30pm UTC](https://discourse.processing.org/t/i-need-help-solving-this-strange-variable-scope-error/24929 "2020-10-26T18:30:47Z")

</div>

So, we all know the common error “local variable ‘yVel’ referenced before assignment”. I got this error, but this time it is different. I am referencing my “yVel” variable outside of the processing draw function, and ins…

---

## [Python Mode : maximum recursion depth](https://discourse.processing.org/t/python-mode-maximum-recursion-depth/24588)

<div class="topic-metadata">

**Author:** [@Grusat](https://discourse.processing.org/u/Grusat)\
**Replies:** 4\
**Last updated:** [October 14, 2020, 9:54pm UTC](https://discourse.processing.org/t/python-mode-maximum-recursion-depth/24588 "2020-10-14T21:54:53Z")

</div>

Does anyone know how to increase the recursion limit like in python : sys.setrecursionlimit() ?

---

## [Rows of circles using while loop and if statement (processing.py)](https://discourse.processing.org/t/rows-of-circles-using-while-loop-and-if-statement-processing-py/24409)

<div class="topic-metadata">

**Author:** [@RoddyPiperVision](https://discourse.processing.org/u/RoddyPiperVision)\
**Replies:** 2\
**Last updated:** [October 7, 2020, 4:57pm UTC](https://discourse.processing.org/t/rows-of-circles-using-while-loop-and-if-statement-processing-py/24409 "2020-10-07T16:57:17Z")

</div>

Hello there! Absolute beginner here. I’ve started to learn about processing.py but I’m struggling with iteration and modulo operator. Using a while loop, I have to recreate this arrangement : I’ve followed some ind…

---

## [Exporting processing.py project as jar file](https://discourse.processing.org/t/exporting-processing-py-project-as-jar-file/24366)

<div class="topic-metadata">

**Author:** [@pi3point1415](https://discourse.processing.org/u/pi3point1415)\
**Replies:** 3\
**Last updated:** [October 5, 2020, 8:45pm UTC](https://discourse.processing.org/t/exporting-processing-py-project-as-jar-file/24366 "2020-10-05T20:45:24Z")

</div>

I have been trying to find a way to export a processing.py project as a single jar file. I am aware of the way to do it with a normal processing project (export, extract core.jar and projectname.jar, compress into a jar …

---

## [Load processing.py as a module in vanilla python project?](https://discourse.processing.org/t/load-processing-py-as-a-module-in-vanilla-python-project/23901)

<div class="topic-metadata">

**Author:** [@pxlmnkeee](https://discourse.processing.org/u/pxlmnkeee)\
**Replies:** 2\
**Last updated:** [September 17, 2020, 4:14am UTC](https://discourse.processing.org/t/load-processing-py-as-a-module-in-vanilla-python-project/23901 "2020-09-17T04:14:06Z")

</div>

I’m sure this is a silly question to ask, but I’m curious if you can load Processing as a module in Python? I love the power and abstraction that Processing provides, but I’m not a huge fan of the PDE. I’d like to use mo…

---

## [Not reuse function!](https://discourse.processing.org/t/not-reuse-function/23353)

<div class="topic-metadata">

**Author:** [@Mayarch](https://discourse.processing.org/u/Mayarch)\
**Replies:** 3\
**Last updated:** [August 21, 2020, 8:27pm UTC](https://discourse.processing.org/t/not-reuse-function/23353 "2020-08-21T20:27:28Z")

</div>

tileCountX=2 tileCountY=10 colorsLeft=\[\] colorsRight=\[\] interpolateShortest=True def setup(): size(800,800) colorMode(HSB) noStroke() shakeColors() def draw(): tileCountX=int(map(mous…

---

## [When using save() function my canvas is always grey](https://discourse.processing.org/t/when-using-save-function-my-canvas-is-always-grey/23492)

<div class="topic-metadata">

**Author:** [@PutridGospel](https://discourse.processing.org/u/PutridGospel)\
**Replies:** 7\
**Last updated:** [September 9, 2020, 12:53pm UTC](https://discourse.processing.org/t/when-using-save-function-my-canvas-is-always-grey/23492 "2020-09-09T12:53:43Z")

</div>

Hey I could use a little help, as my title says I am having trouble getting some high resolution files of my artwork. Here is my code please let me know what I could do to get high resolution images of the artwork I make…

---

## [Infinite value for algorithm](https://discourse.processing.org/t/infinite-value-for-algorithm/23661)

<div class="topic-metadata">

**Author:** [@arcadeperfect](https://discourse.processing.org/u/arcadeperfect)\
**Replies:** 2\
**Last updated:** [September 3, 2020, 9:21pm UTC](https://discourse.processing.org/t/infinite-value-for-algorithm/23661 "2020-09-03T21:21:22Z")

</div>

Hi Is there an equivalent of float(‘inf’) in Python to use in min operations to find the smallest value in a loop? Thanks

---

## [Intervals visible using perlin noise and curveVertex](https://discourse.processing.org/t/intervals-visible-using-perlin-noise-and-curvevertex/23532)

<div class="topic-metadata">

**Author:** [@benf](https://discourse.processing.org/u/benf)\
**Replies:** 4\
**Last updated:** [August 28, 2020, 11:02am UTC](https://discourse.processing.org/t/intervals-visible-using-perlin-noise-and-curvevertex/23532 "2020-08-28T11:02:20Z")

</div>

Hi I was trying to use perlin noise for the first time using it to gently nudge some coordinates every interval along the y-axis and connecting those with curveVertex. When I looked at the image I saw those intervals w…

[Previous page](https://discourse.processing.org/c/processing-py/9.md?page=6)

[Next page](https://discourse.processing.org/c/processing-py/9.md?page=8)
