Hi everyone
First post but I have been browsing as a guest for help with my university python project for a while now. There some really great help on here, Thank you!

Right I'm doing a beginners python programming unit as part of my uni course, and as part of that unit I have to do a project. This project being to create a pyramid consisting of 2 different "Patches" if you like, if you take a look below you can see on of the "patches" is finished (nestedCircles()), but as for the other "patch" (Diamonds()) I just cant work out how to do it, this is an example of the patch I have to do:-[IMG]http://img101.imageshack.us/img101/3275/diamondss.jpg[/IMG]

from graphics import *

def nestedCircles():
    win = GraphWin("Circles", 100,100)
    yValue = 51
    centre = Point(51.47,yValue)
    radius = 50
    circle1 = Circle(centre, radius)
    for i in range(10):
        radius = radius - 5
        yValue = yValue + 5
        centre = Point(50,yValue)
        circle1 = Circle(centre, radius)

def diamonds():
    win = GraphWin("Lines", 100,100)
    yValue = 20
    line1 = Line(Point(200,200), Point(900,900))
    for i in range(9):
        line1 = Line(Point(90,10), Point(5,3))

Any help with this would be soo gratefully received, don't forget I have only been doing python for 2 months now! :)


Just a little experiment, you can go from there ...

from graphics import *

def diamonds():
    win = GraphWin("Lines", 200, 200)
    #Line(Point(0, 0), Point(200, 200)).draw(win)  # test
    x = 0
    for y in range(0, 190, 20):
        x1 = x
        y1 = y
        x2 = 200
        y2 = 200
        print x1, y1, x2, y2  # test
        Line(Point(x1, y1), Point(x2 - y, y2)).draw(win)
        Line(Point(x2, y1), Point(x1 + y, y2)).draw(win)

    # pause for click in window

That's the one tonyjv, I don't think it likes my 64bit operating system as it more often than not, crashes, so I have to restart python

If you are using the 64 bit version of Python26 with modules like that, you can get into trouble, simply use the win32 version.

Edited 6 Years Ago by vegaseat: ,

This question has already been answered. Start a new discussion instead.