# Processing.py

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

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

**Page:** 15

---

## [Have code inside if else statement run continuosly](https://discourse.processing.org/t/have-code-inside-if-else-statement-run-continuosly/7765)

<div class="topic-metadata">

**Author:** [@tiedbranches](https://discourse.processing.org/u/tiedbranches)\
**Replies:** 6\
**Last updated:** [January 23, 2019, 5:45pm UTC](https://discourse.processing.org/t/have-code-inside-if-else-statement-run-continuosly/7765 "2019-01-23T17:45:51Z")

</div>

Hi, I’m trying to have different bits of code inside draw() run continuously but be activated by different key presses. The problem is that what is inside the if else statement only runs while I am pressing the key. Wh…

---

## [Dungeon exploration game bug: no output](https://discourse.processing.org/t/dungeon-exploration-game-bug-no-output/7655)

<div class="topic-metadata">

**Author:** [@kwunlokalex](https://discourse.processing.org/u/kwunlokalex)\
**Replies:** 8\
**Last updated:** [January 22, 2019, 3:25pm UTC](https://discourse.processing.org/t/dungeon-exploration-game-bug-no-output/7655 "2019-01-22T15:25:20Z")

</div>

hi, i create a dungeon exploration game for my project, it is not done yet but i encounter some weird bug. There is not output (form print statement or the animation). I used python mode in here. Please provide help and …

---

## [\[RESOLVED\] Declaring a class function and using it inside the same class?](https://discourse.processing.org/t/resolved-declaring-a-class-function-and-using-it-inside-the-same-class/7626)

<div class="topic-metadata">

**Author:** [@Sky](https://discourse.processing.org/u/Sky)\
**Replies:** 3\
**Last updated:** [January 20, 2019, 5:07pm UTC](https://discourse.processing.org/t/resolved-declaring-a-class-function-and-using-it-inside-the-same-class/7626 "2019-01-20T17:07:21Z")

</div>

def idle(self): if self.imgcount \> len(self.idle) - 1 : self.imgcount = 0 if self.face == 'RIGHT': image(self.idle\[self.imgcount\],self.vec.x,self.vec.y,self.w,self…

---

## [Reverse a Sprite without editing?](https://discourse.processing.org/t/reverse-a-sprite-without-editing/7444)

<div class="topic-metadata">

**Author:** [@Sky](https://discourse.processing.org/u/Sky)\
**Replies:** 4\
**Last updated:** [January 13, 2019, 7:59pm UTC](https://discourse.processing.org/t/reverse-a-sprite-without-editing/7444 "2019-01-13T19:59:10Z")

</div>

I have sprite animation of a player walking to right direction, but not to left. Do I have to edit all the sprites? (Credits to MInd Chamber)

---

## [\[SOLVED\] Image() nullPtrException](https://discourse.processing.org/t/solved-image-nullptrexception/7424)

<div class="topic-metadata">

**Author:** [@Sky](https://discourse.processing.org/u/Sky)\
**Replies:** 7\
**Last updated:** [January 12, 2019, 6:50pm UTC](https://discourse.processing.org/t/solved-image-nullptrexception/7424 "2019-01-12T18:50:34Z")

</div>

processing.app.SketchException: java.lang.NullPointerException at processing.core.PGraphics.image(PGraphics.java:3771) at processing.core.PApplet.image(PApplet.java:12655) at sun.reflect.GeneratedMethodAccessor10.inv…

---

## [\[Solved(more or less)\] fullScreen() width height not existing](https://discourse.processing.org/t/solved-more-or-less-fullscreen-width-height-not-existing/7387)

<div class="topic-metadata">

**Author:** [@Sky](https://discourse.processing.org/u/Sky)\
**Replies:** 3\
**Last updated:** [January 10, 2019, 1:26pm UTC](https://discourse.processing.org/t/solved-more-or-less-fullscreen-width-height-not-existing/7387 "2019-01-10T13:26:35Z")

</div>

def setup(): fullScreen() # class BlackHole: # def \_\_init\_\_(self): # self.vec = PVector(height/2,width/2) # def show(self): # ellipse(height/2,width/2,100,100) # hole = Blac…

---

## [Player movement laggy](https://discourse.processing.org/t/player-movement-laggy/7366)

<div class="topic-metadata">

**Author:** [@Sky](https://discourse.processing.org/u/Sky)\
**Replies:** 1\
**Last updated:** [January 9, 2019, 7:27pm UTC](https://discourse.processing.org/t/player-movement-laggy/7366 "2019-01-09T19:27:35Z")

</div>

Where I move player: def keyPressed(self): if keyPressed: if key == 'a' or key == 'A': self.state = "LEFT" elif key == 'd' or key == 'D': self.state = …

---

## [\[HELP\]\[ Python vs Java \] size(width,height)](https://discourse.processing.org/t/help-python-vs-java-size-width-height/7320)

<div class="topic-metadata">

**Author:** [@Sky](https://discourse.processing.org/u/Sky)\
**Replies:** 2\
**Last updated:** [January 8, 2019, 3:35pm UTC](https://discourse.processing.org/t/help-python-vs-java-size-width-height/7320 "2019-01-08T15:35:36Z")

</div>

:coffee::snake::coffee::snake::coffee::snake::coffee::snake::coffee::snake::coffee::snake::coffee::snake::coffee::snake::coffee::snake::coffee::snake::coffee::snake::coffee::snake::coffee::snake::coffee::snake::coffee: W…

---

## [❄ Snow!](https://discourse.processing.org/t/snow/7156)

<div class="topic-metadata">

**Author:** [@Sky](https://discourse.processing.org/u/Sky)\
**Replies:** 2\
**Last updated:** [January 7, 2019, 6:12pm UTC](https://discourse.processing.org/t/snow/7156 "2019-01-07T18:12:44Z")

</div>

from random import randint class flake: def \_\_init\_\_ (self,x,y): self.vec = PVector(x,y) self.z = random(0,3) self.velY = map(self.z,0,3,0.5,1) self.velX = 0 def …

---

## [Make a program with percentage](https://discourse.processing.org/t/make-a-program-with-percentage/6677)

<div class="topic-metadata">

**Author:** [@justin38](https://discourse.processing.org/u/justin38)\
**Replies:** 17\
**Last updated:** [January 6, 2019, 7:09pm UTC](https://discourse.processing.org/t/make-a-program-with-percentage/6677 "2019-01-06T19:09:46Z")

</div>

Hello, I would like to create a code where we can move shield shapes on a warrior and know the percentage of the warrior covered, I unfortunately do not know how to do it, help me please

---

## [\[.snake. game in 🐍 language\]Ouch my tail!](https://discourse.processing.org/t/snake-game-in-language-ouch-my-tail/7062)

<div class="topic-metadata">

**Author:** [@Sky](https://discourse.processing.org/u/Sky)\
**Replies:** 3\
**Last updated:** [January 1, 2019, 12:20pm UTC](https://discourse.processing.org/t/snake-game-in-language-ouch-my-tail/7062 "2019-01-01T12:20:01Z")

</div>

Heres the C++ code: #include \<iostream\> #include \<cstdlib\> #include \<ctime\> #include \<conio.h\> #include \<windows.h\> #include \<fstream\> using namespace std; enum direction {STOP = 0,LEFT,RIGHT,UP,DOWN}; struct coord{ …

---

## [\[garbage\]\[🐍 game\]List has no attribute X (or Y)](https://discourse.processing.org/t/garbage-game-list-has-no-attribute-x-or-y/7053)

<div class="topic-metadata">

**Author:** [@Sky](https://discourse.processing.org/u/Sky)\
**Replies:** 29\
**Last updated:** [December 31, 2018, 5:07pm UTC](https://discourse.processing.org/t/garbage-game-list-has-no-attribute-x-or-y/7053 "2018-12-31T17:07:06Z")

</div>

if dist(snake.vec.x,snake.vec.y,fruit.vec.x,fruit.vec.y) \< 12.5: fruit.respawn() snake.score += 1 snake.addtail(snake.vec.x,snake.vec.y) def addtail(self,x,y): self.prevs.append(PVecto…

---

## [Colors! (a lot of colors but not all of them)](https://discourse.processing.org/t/colors-a-lot-of-colors-but-not-all-of-them/7022)

<div class="topic-metadata">

**Author:** [@Sky](https://discourse.processing.org/u/Sky)\
**Replies:** 1\
**Last updated:** [December 30, 2018, 9:35pm UTC](https://discourse.processing.org/t/colors-a-lot-of-colors-but-not-all-of-them/7022 "2018-12-30T21:35:44Z")

</div>

import random class Walker: def \_\_init\_\_ (self): self.x = width \>\> 1 self.y = height \>\> 1 self.foot = 10 #space between every step self.strw = 3#stroke weight def move(self): …

---

## [\[RESOLVED\] Rotating a quad() towards player(that moves around)](https://discourse.processing.org/t/resolved-rotating-a-quad-towards-player-that-moves-around/6997)

<div class="topic-metadata">

**Author:** [@Sky](https://discourse.processing.org/u/Sky)\
**Replies:** 4\
**Last updated:** [December 29, 2018, 9:50pm UTC](https://discourse.processing.org/t/resolved-rotating-a-quad-towards-player-that-moves-around/6997 "2018-12-29T21:50:39Z")

</div>

def AI(self,plx,ply): #traslates angle1 = atan2(ply - self.y1,plx - self.x1) self.x1 = cos(angle1) \* self.speed + self.x1 self.y1 = sin(angle1) \* self.speed + self.y1 self.x2 = co…

---

## [\[SOLVED\] Diagonal Movement](https://discourse.processing.org/t/solved-diagonal-movement/6978)

<div class="topic-metadata">

**Author:** [@Sky](https://discourse.processing.org/u/Sky)\
**Replies:** 5\
**Last updated:** [December 29, 2018, 11:30am UTC](https://discourse.processing.org/t/solved-diagonal-movement/6978 "2018-12-29T11:30:56Z")

</div>

:snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake::snake: Hello again, no…

---

## [Size() not working with variables arguments](https://discourse.processing.org/t/size-not-working-with-variables-arguments/6665)

<div class="topic-metadata">

**Author:** [@Laurent](https://discourse.processing.org/u/Laurent)\
**Replies:** 5\
**Last updated:** [December 29, 2018, 5:46am UTC](https://discourse.processing.org/t/size-not-working-with-variables-arguments/6665 "2018-12-29T05:46:57Z")

</div>

Hi everyone, The below code is not working with Processing.py (instead of the passed arguments the default values for width and height applies, that are 100x100 pixels: same results as size() statement, with no argument…

---

## [\[SOLVED\] Need Help With Game Menu (Python)](https://discourse.processing.org/t/solved-need-help-with-game-menu-python/6963)

<div class="topic-metadata">

**Author:** [@Sky](https://discourse.processing.org/u/Sky)\
**Replies:** 1\
**Last updated:** [December 29, 2018, 4:22am UTC](https://discourse.processing.org/t/solved-need-help-with-game-menu-python/6963 "2018-12-29T04:22:28Z")

</div>

Hello guys, I know there are a lot of topics about “Game Menu”, but I cant fix my problem Heres the code : The sketch: import Classex #import Player import random width = 1000 height = width/2 def setup (): smoo…

---

## [UnsatisfiedLinkError with Processing and Pycom](https://discourse.processing.org/t/unsatisfiedlinkerror-with-processing-and-pycom/6533)

<div class="topic-metadata">

**Author:** [@wuihee](https://discourse.processing.org/u/wuihee)\
**Replies:** 0\
**Last updated:** [December 12, 2018, 9:22am UTC](https://discourse.processing.org/t/unsatisfiedlinkerror-with-processing-and-pycom/6533 "2018-12-12T09:22:09Z")

</div>

Hello! I’m using Processing with Pycom to run an accelerometer example. However, when I run my code in processing I get this error: processing.app.SketchException: java.lang.UnsatisfiedLinkError: jssc.SerialNativeInterf…

---

## [Issue with clear()](https://discourse.processing.org/t/issue-with-clear/6307)

<div class="topic-metadata">

**Author:** [@dashmc](https://discourse.processing.org/u/dashmc)\
**Replies:** 10\
**Last updated:** [December 8, 2018, 6:51pm UTC](https://discourse.processing.org/t/issue-with-clear/6307 "2018-12-08T18:51:06Z")

</div>

I am trying to make it so the canvas clears when I click, but it always just comes back right away. Any Ideas? Here is my code: global cWidth global cHeight cWidth=600 cHeight=600 class character(object): def \_\_init…

---

## [Cell Division and Growth Algorithm: Adding springs](https://discourse.processing.org/t/cell-division-and-growth-algorithm-adding-springs/6131)

<div class="topic-metadata">

**Author:** [@solub](https://discourse.processing.org/u/solub)\
**Replies:** 10\
**Last updated:** [December 7, 2018, 7:45pm UTC](https://discourse.processing.org/t/cell-division-and-growth-algorithm-adding-springs/6131 "2018-12-07T19:45:06Z")

</div>

Hi, I’m desperately trying to connect growing cells with springs using the toxiclibs library. More specifically, I’d like to to put a spring between a “mother” cell and its “child” after division. PROBLEMS: All cell…

---

## [How do I make a second level on processing.py](https://discourse.processing.org/t/how-do-i-make-a-second-level-on-processing-py/6244)

<div class="topic-metadata">

**Author:** [@dashmc](https://discourse.processing.org/u/dashmc)\
**Replies:** 1\
**Last updated:** [December 6, 2018, 11:48pm UTC](https://discourse.processing.org/t/how-do-i-make-a-second-level-on-processing-py/6244 "2018-12-06T23:48:11Z")

</div>

Here is my code so far. Level two is not activating when I need it to. Any ideas? Pls help global cWidth global cHeight cWidth=600 cHeight=600 level1 = True level2 = False class character(object): def \_\_init\_\_(self)…

---

## [Python Processing and Anaconda](https://discourse.processing.org/t/python-processing-and-anaconda/5986)

<div class="topic-metadata">

**Author:** [@borres](https://discourse.processing.org/u/borres)\
**Replies:** 2\
**Last updated:** [December 5, 2018, 2:47am UTC](https://discourse.processing.org/t/python-processing-and-anaconda/5986 "2018-12-05T02:47:15Z")

</div>

Can I combine Processing in Python and Anaconda ?

---

## [Pushing cell agents](https://discourse.processing.org/t/pushing-cell-agents/6077)

<div class="topic-metadata">

**Author:** [@solub](https://discourse.processing.org/u/solub)\
**Replies:** 5\
**Last updated:** [December 1, 2018, 1:42pm UTC](https://discourse.processing.org/t/pushing-cell-agents/6077 "2018-12-01T13:42:01Z")

</div>

Hi, I’m trying to make a Cell Division and Growth algorithm where cell agents are pushed right next to neighboring cell just after the division process. I’d like the final output to look like a circle packing. Howeve…

---

## [Generative floor plans with Permutation algorithm](https://discourse.processing.org/t/generative-floor-plans-with-permutation-algorithm/5140)

<div class="topic-metadata">

**Author:** [@solub](https://discourse.processing.org/u/solub)\
**Replies:** 7\
**Last updated:** [November 26, 2018, 7:22pm UTC](https://discourse.processing.org/t/generative-floor-plans-with-permutation-algorithm/5140 "2018-11-26T19:22:36Z")

</div>

Dear all, I would need your help to implement a permutation algorithm allowing the generation of building plans, that I’ve recently stumbled on while reading Professor Kostas Terzidis’ latest publication: Permutation D…

---

## [Depth of Field effect with a shader](https://discourse.processing.org/t/depth-of-field-effect-with-a-shader/265)

<div class="topic-metadata">

**Author:** [@solub](https://discourse.processing.org/u/solub)\
**Replies:** 11\
**Last updated:** [November 26, 2018, 9:02am UTC](https://discourse.processing.org/t/depth-of-field-effect-with-a-shader/265 "2018-11-26T09:02:16Z")

</div>

Hi all, As some of you may already know I’m trying to make a Depth of Field effect in Python mode. I’ve recently stumbled onto this thread where I could get hold of a Proscene DOF demo sketch based on the following sha…

---

## [Java to Python: Incrementation within "if" statement](https://discourse.processing.org/t/java-to-python-incrementation-within-if-statement/5655)

<div class="topic-metadata">

**Author:** [@solub](https://discourse.processing.org/u/solub)\
**Replies:** 3\
**Last updated:** [November 18, 2018, 1:51am UTC](https://discourse.processing.org/t/java-to-python-incrementation-within-if-statement/5655 "2018-11-18T01:51:55Z")

</div>

Hi, I was just wondering how you would convert that snippet to Python ? for(int i=0; i\<space.length; i++){ int k=0; while(numCubes\<space\[i\]){ ... if((k++)\>100){ done = 1; I’m not…

---

## [Should I learn Processing with Python](https://discourse.processing.org/t/should-i-learn-processing-with-python/5576)

<div class="topic-metadata">

**Author:** [@wsnicol](https://discourse.processing.org/u/wsnicol)\
**Replies:** 8\
**Last updated:** [November 16, 2018, 10:47am UTC](https://discourse.processing.org/t/should-i-learn-processing-with-python/5576 "2018-11-16T10:47:10Z")

</div>

Hey! I’m fairly new to Processing, and have never used Java before. I’m working through Casey Reas and Ben Fry’s “Processing” book and Daniel Shiffman’s “The Nature of Code” and am having no problems learning the softwar…

---

## [Unicode Decode Error](https://discourse.processing.org/t/unicode-decode-error/5367)

<div class="topic-metadata">

**Author:** [@prof.leleu](https://discourse.processing.org/u/prof.leleu)\
**Replies:** 2\
**Last updated:** [November 11, 2018, 5:44pm UTC](https://discourse.processing.org/t/unicode-decode-error/5367 "2018-11-11T17:44:21Z")

</div>

Hi. On my personal computers, processing works like a charm. I use it in python mode. On my school’s computers everytime i load a script or even if i save a script, when I try to run it I get this : processing.app.Ske…

---

## [Python Processing in own IDLE](https://discourse.processing.org/t/python-processing-in-own-idle/1319)

<div class="topic-metadata">

**Author:** [@KeirMeDear](https://discourse.processing.org/u/KeirMeDear)\
**Replies:** 3\
**Last updated:** [October 30, 2018, 12:16pm UTC](https://discourse.processing.org/t/python-processing-in-own-idle/1319 "2018-10-30T12:16:12Z")

</div>

I just wondered if there was a way that I could write/run python processing sketches in an IDLE instead of the default processing IDLE (for example Sublime, Atom, etc). Many thanks!

---

## [Arduino use Processing for Python](https://discourse.processing.org/t/arduino-use-processing-for-python/4392)

<div class="topic-metadata">

**Author:** [@DemianLa](https://discourse.processing.org/u/DemianLa)\
**Replies:** 1\
**Last updated:** [October 28, 2018, 12:22pm UTC](https://discourse.processing.org/t/arduino-use-processing-for-python/4392 "2018-10-28T12:22:39Z")

</div>

Someone have an idea how i can use this Code for Windows USB port COM1 “a = Arduino(this, ‘/dev/ttyACM1’, 57600)” this Code is for LINUX but i need it for Windows to USE Python on Arduino. Or somone have another Idea to…

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

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