Friday, June 12, 2015

combineCircular!

Today we will be converting this program by tara milani on open processing from java to python. This program uses math to draw a series of ellipse to make a pattern. 

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 ( ; ) Next we are going to get rid of the word float everywhere it appears, we d this because we do not need a float to declare a variable in python. So far your code should look like this:



 Now, right under def draw (): we are going to add global a (new line) global b (new line) global y (new line) global x We do this because in python when a variable is called in only looks for the variable under the draw function, but by adding global it knows to look outside the function. Your code should now look like this: 





Now you're done, your code should print out a program that draws a series of circles into a pattern. 



1 comment:

  1. Sands Casino | Play Online Casino & Slot Machine
    Enjoy your slot หาเงินออนไลน์ or video poker action with septcasino our Las Vegas style online casino. Choose from hundreds of 카지노사이트 exciting slots, table games and more. Slot Machine Games:

    ReplyDelete