I need the function to display a set of eyes, so if i call the function
Eyes(3,4) a graphics window opens with exact dimesions for 4 coloumns and 2 rows of eyes...

from graphics import *
def drawCircle(win, centre, radius, colour):
    circle = Circle(centre, radius)
    circle.setFill(colour)
    circle.setWidth(2)
    circle.draw(win)

def drawEye():
    w = 250
    h = 250
    win = GraphWin(" Eye", w, h)
    # center should be at 1/2 width and height
    centre = Point(w//2, h//2)
    drawCircle(win, centre, 40, "white")
    drawCircle(win, centre, 20, "blue")
    drawCircle(win, centre, 10, "black")
    # click mouse to go on
    win.getMouse() 
    win.close()

drawEye()

def Eyes(rows, columns):
    for i in range( rows ):
        print colums * draweye
Eyes()

Edited 7 Years Ago by gangster88: n/a

Can you please be more clear, from what I understand you want 8 eyes total to be printed out on the screen, but with the radius size of 40 you have, all there is room for is a single eye before overlap.

Can you please be more clear, from what I understand you want 8 eyes total to be printed out on the screen, but with the radius size of 40 you have, all there is room for is a single eye before overlap.

...

Edited 7 Years Ago by jaison2: n/a

Can you please be more clear, from what I understand you want 8 eyes total to be printed out on the screen, but with the radius size of 40 you have, all there is room for is a single eye before overlap.

well thts wht i need help with, the window should automatically change according to the number of eyes requested?

from graphics import *

def drawCircle(win, centre, radius, colour, color):
    circle = Circle(centre, radius)
    circle.setFill(colour)
    circle.setOutline(color)
    circle.draw(win)

def drawEye(win, center, radius):
    # center should be at half width and height
    drawCircle(win, center, radius, "white", "black")
    drawCircle(win, center, radius*0.5, "blue", "blue")
    drawCircle(win, center, radius*0.25, "black", "blue")

def Eyes(rows, columns):
      radius = 100
      diameter = 2 * radius
      width = rows*diameter+1
      height = columns*diameter+1
      win = GraphWin("", width, height )
      for x in range( rows ):
         for y in range( columns ):
            xPosition = radius + 2 + diameter * x
            yPosition = radius + 2 + diameter * y
            center = Point( xPosition, yPosition )
            drawEye( win, center, radius )

Eyes(4,3)

is that it?

Edited 3 Years Ago by Reverend Jim: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.