0

Hi there,
I am trying to repeat my triangle on 100px by 100px;

Any help is much appreciated.

Many thanks,

Ashley

def drawTrianglePatch(win, x, y, colour):
    for i in range(5):
        for j in range(5):
            if (i + j) % 2 == 0:
                triangle = i * 20
                triangle = y + j * 20
                triangle = Polygon((Point(100,20), Point(80,60), Point(120,20)),
                Point( + 20, repeatY + 20))
                triangle.setFill(colour)
                triangle.draw(win)
3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by woooee
0

You should be using "x" and "y" passed to the function for your start position instead of the hard coded one. You can then pass a different x, y (start) to the function, assuming you are always drawing the same size triangle. In Tkinter (which doesn't look what you are using) you can also move an object to the postion you want so perhaps your GUI has a similar function.

## the preferred way if your GUI has a similar method
goto(x ,y)

## offset the postion otherwise
triangle = Polygon((Point(x+100,y+20), Point(x+80,y+60), Point(x+120,y+20)))    

Edited by woooee

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.