image_(2)image_(2) Hi There,

I'm having a problem looping text I have attached an image of what I want.

Thanks in advance,

Ashley

def drawPatch(win, x, y, colour):
    for i in range(5):
        for j in range(5):
                topLeftX = x + i * 20
                topLeftY = y + j * 20
                centreX = x + i * 25
                centreY = y + j * 25
                rectangle = Rectangle(Point(topLeftX, topLeftY),
                                      Point(topLeftX + 20, topLeftY + 20))
                rectangle.setOutline(colour)
                rectangle.draw(win)
                text = Text((Point(centreX, centreY),
                Point(centreX + 20, centreY + 20)),"Hi!")
                text.draw(win)

It is not obvious what you are trying to do. Nor is it obvious what GUI toolkit you are using, although it is not Tkinter or Wx which is all that I use, so we can not run your code (no imports posted). If you are trying to draw the grid, you would draw 5 vertical lines and then 5 horizontal lines.

## draw 5 vertical lines
increment=20
for ctr in range(5):
    start_x = x + increment*ctr
    create_line(start_x, start_y, start_x, start_y+length)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.