There is a library simple_draw for drawing simple graphic primitives. I can not figure out how to draw a cycle of vertical lines, or rather, I have one line in each row with a shift.

enter image description here

 width = 100 height = 50 x = 0 y = 0 x_1 = 100 y_1 = 50 rows = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) x0 = 0 y0 = 0 x1 = 600 y1 = 0 x_v_0 = 0 y_v_0 = 0 x_v_1 = 0 y_v_1 = 50 for row in rows: y1 += 50 start_point = sd.get_point(0, y1) end_point = sd.get_point(600, y1) sd.line(start_point=start_point, end_point=end_point, color=sd.COLOR_ORANGE, width=6) for row_v in range(6): x_v_0 += width y_v_0 += height x_v_1 += width y_v_1 += height start_point1 = sd.get_point(x_v_0, y_v_0) end_point1 = sd.get_point(x_v_1, y_v_1) sd.line(start_point=start_point1, end_point=end_point1, color=sd.COLOR_ORANGE, width=6) 

    1 answer 1

    In cycle

     for row_v in range(6): 

    You simultaneously increase the x coordinate and y coordinate

     x_v_0 += width y_v_0 += height x_v_1 += width y_v_1 += height 

    And you need to consider such a wall as a two-dimensional array, i.e. first we go through the first line and draw vertical lines, while the y coordinate does not change, but only the x coordinate changes. When you go to the next line, y increases, and x is reset. At the same time, to get a really similar brick wall, you need to add through the line a shift equal to half the length of the brick.

     for row in rows: y1 += 50 start_point = sd.get_point(0, y1) end_point = sd.get_point(600, y1) sd.line(start_point=start_point, end_point=end_point, color=sd.COLOR_ORANGE, width=6) # Четная строка if row % 2 == 0: x_v_0 = 0 x_v_1 = 0 for row_v in range(7): start_point1 = sd.get_point(x_v_0, y_v_0) end_point1 = sd.get_point(x_v_1, y_v_1) sd.line(start_point=start_point1, end_point=end_point1, color=sd.COLOR_ORANGE, width=6) x_v_0 += width x_v_1 += width # Нечётная строка else: # Сдвиг x_v_0 = width / 2 x_v_1 = width / 2 for row_v in range(6): start_point1 = sd.get_point(x_v_0, y_v_0) end_point1 = sd.get_point(x_v_1, y_v_1) sd.line(start_point=start_point1, end_point=end_point1, color=sd.COLOR_ORANGE, width=6) x_v_0 += width x_v_1 += width # Закончили рисовать одну строку, увеличиваем координаты `y` y_v_0 += height y_v_1 += height 

    Wall

    • one
      Cool though))) - Flippy
    • one
      @Flippy If the answer is useful, then the author is always pleased when his answer is marked as useful. And if the answer also solved the problem, then you need to mark it as accepted. - Enikeyschik
    • one
      Now I get it)) - Radick