Wednesday, June 17, 2015

String of Random Circles!

Today I will be changing this program (by Cater Beeman/Karsten Weiss on Open Processing) to Python mode. 

As usual the first thing we will do is change void setup(){} and void draw(){} to def setup (): and def draw (): and get rid of all the semi colons (;) and all the curly brackets ({}) and add colons (:)next to all the if statements. Now get rid of the word float and the word break, as we do not need use these in this case in Python. So far your code should look like this:



Now we are going to get rid of the lines of code; switch(key) and case 'c': and instead put in  key.lowcase == "c" Your code will look like this: 

When you run it you should get a program that draws something like this (when you click and drag the mouse): 


No comments:

Post a Comment