-1

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)

Edited by ashley9210: Picture upload

2
Contributors
1
Reply
6
Views
4 Years
Discussion Span
Last Post by woooee
0

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)

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.