Hi guys I am looking to create the following as shown below. Anybody able to give me a hand as im really struggling to make the rectangles different lengths.

Red rectangles looks same size for me and spacing is also constant.
Role of spacing rectangles and red rectangles only alternate with spacing white ones. 3 white, 3 red, 3 white ....

I don't have a lot of time, but here is a simple example to start you, using Tkinter. The other GUI toolkits, WxPython and QT, would be similar.

from Tkinter import *
root = Tk()
root.title('Rectangle Test')
canvas = Canvas(root, width =300, height=300)
## top_left_x, top_left_y, bottom_right_x, bottom_right_y
points_list = [0, 0, 25, 25]
color = "red"
for row in range(3):
for col in range(3):
rectang = canvas.create_rectangle(points_list[0], points_list[1], \
points_list[2], points_list[3], fill=color)
## increase along the x axis
for point in [0, 2]:
points_list[point] += 50
## move down one row
if row%2: ## row is an odd number
points_list = [ 0, points_list[1]+25, 25, points_list[3]+25]
else: ## row is an even number
points_list = [25, points_list[1]+25, 50, points_list[3]+25]
canvas.pack()
root.mainloop()

The middle rectangle, be it red or white is centered, so if you have a 200x200 canvas, the middle would be 100. You can then move left or right, calculating the end position of the first red square for the rows with 4 red squares; end position=middle - (1.5 white + 1 red). The other row is obviously rectangles of the same size.

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...

Hi. so this is actually a continuation from another question of mineHere but i was advised to start a new thread as the original question was already answered.

This is the result of previous question answered :

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...