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()
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, points_list, \
points_list, points_list, 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+25, 25, points_list+25]
else: ## row is an even number
points_list = [25, points_list+25, 50, points_list+25]
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 ...
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 ...