I do some art analog and digital. This time i did some color test digitally. To work on my programming skill so that its shareable im asking for help to get some code review.
Hows the readability?
Is it easy to follow line of thought?
Suggestion as to how to improve?
Greetings Johan
#A program for fun to see how red, blue and purple appears at resolution
from math import *
from graphics import *
def hole(win, centerx, centery, radius): #draws an inverted sphere
for circle in range(radius, 0, -1):
c = Circle(Point(centerx, centery), circle)
c.setWidth(0)
coloratangle = int(sin(circle/radius*pi/2)*255) #max resolution from black to white is 255 steps
c.setFill(color_rgb(coloratangle * (circle % 2), 0, coloratangle * ((circle + 1) % 2))) # Modulus instead of Boolean? Modulus in c.setFill or in another line?
c.draw(win)
windowheight = 1350
windowwidth = 730
win = GraphWin("My Circle", windowheight, windowwidth)
win.setBackground(color_rgb(255, 100, 100))
centerx = int(windowheight / 2)
centery = int(windowwidth / 2) #intetger
radius = int(sqrt(centerx**2 + centery**2)) #pythagoras
hole(win, centerx, centery, radius)
win.getMouse() # Pause to view result
win.close() # Close window when done
```