def display_phrase(phrase):
    count = 0
    result = None
    for char in phrase:
        temp = char_map[char]
        if (count == 0):
            result = temp
            result = result.concatenate(Matrix(5, (255, 255, 255)))
        else:
            result = result.concatenate(temp)
            result = result.concatenate(Matrix(5, (255, 255, 255)))
        count = count + 1
    result.test_display()
Exemple #2
0
def execute(message, length, height, buffer):

    test = generate_message_matrix(message, height, length)
    while (not test.is_empty()):
        display(test, length)
        test.shift_horizontal(True, Matrix(height, 1))
        print("")
        time.sleep(buffer)
Exemple #3
0
def generate_message_matrix(message, height, length):
    count = 0
    result = None
    for char in message:
        temp = char_map[char]
        if (count == 0):
            result = temp
            result = result.concatenate(Matrix(height, 1))
        else:
            result = result.concatenate(temp)
            result = result.concatenate(Matrix(height, 1))
        count = count + 1

    #pad with empty pixels to fill out board
    if (result.n < length):
        result = result.concatenate(Matrix(height, length - result.n))

    return result
from MatrixRGB import Matrix


#constructor - no data set
print ("Constructor Tests:")
test = Matrix(3,3)
test.print_matrix()

print("")

other_test = Matrix(2,2,[(0,1,(8,8,8))])
other_test.print_matrix()

print("")

#copy constructor
print("Copy construct")
third_test = other_test.copy_construct()
third_test.print_matrix()

print("")

#setdatum and getdatum
print ("Getter and Setter tests")
test.setdatum(0,0,(23,45,64))
print (test.getdatum(0,0))
test.print_matrix()

print("")

#getcolumn, getrow, get_submatrix
from MatrixRGB import Matrix

#constructor - no data set
print("Constructor Tests:")
test = Matrix(3, 3)
test.print_matrix()

print("")

other_test = Matrix(2, 2, [(0, 1, (8, 8, 8))])
other_test.print_matrix()

print("")

#copy constructor
print("Copy construct")
third_test = other_test.copy_construct()
third_test.print_matrix()

print("")

#setdatum and getdatum
print("Getter and Setter tests")
test.setdatum(0, 0, (23, 45, 64))
print(test.getdatum(0, 0))
test.print_matrix()

print("")

#getcolumn, getrow, get_submatrix
print("Get column + row + submatrix")
        ';' : Matrix(5, 2, [(1,1,1), (3,1,1), (4,0,1)]),
        ':' : Matrix(5, 1, [(1,0,1), (3,0,1)]),
        '!' : Matrix(5, 1, [(0,0,1), (1,0,1), (2,0,1), (4,0,1)]),
        '?' : Matrix(5, 3, [(0,0,1), (0,1,1), (0,2,1), (1,2,1), (2,1,1), (2,2,1), (3,1,1), (4,1,1)]), #LOOKS A LITTLE WEIRD
        '/' : Matrix(5, 3, [(0,2,1), (2,1,1), (4,0,1)]), #LOOKS A LITTLE WEIRD
        '"' : Matrix(5, 3, [(0,0,1), (0,1,1), (1,0,1), (1,1,1)]),
        ' ' : Matrix(5, 1),
        '\'' : Matrix(5, 1, [(0,0,1), (1,0,1)])
        }
'''

char_map = {
    'a':
    Matrix(5, 3, [(0, 1, (255, 255, 255)), (1, 0, (255, 255, 255)),
                  (1, 2, (255, 255, 255)), (2, 0, (255, 255, 255)),
                  (2, 1, (255, 255, 255)), (2, 2, (255, 255, 255)),
                  (3, 0, (255, 255, 255)), (3, 2, (255, 255, 255)),
                  (4, 0, (255, 255, 255)), (4, 2, (255, 255, 255))]),
    'b':
    Matrix(5, 3, [(0, 0, (255, 255, 255)), (0, 1, (255, 255, 255)),
                  (1, 0, (255, 255, 255)), (1, 1, (255, 255, 255)),
                  (2, 0, (255, 255, 255)), (2, 1, (255, 255, 255)),
                  (2, 2, (255, 255, 255)), (3, 0, (255, 255, 255)),
                  (3, 2, (255, 255, 255)), (4, 0, (255, 255, 255)),
                  (4, 1, (255, 255, 255)),
                  (4, 2, (255, 255, 255))]),  #LOOKS A LITTLE WEIRD
    'c':
    Matrix(5, 3, [(0, 0, (255, 255, 255)), (0, 1, (255, 255, 255)),
                  (0, 2, (255, 255, 255)), (1, 0, (255, 255, 255)),
                  (2, 0, (255, 255, 255)), (3, 0, (255, 255, 255)),
                  (4, 0, (255, 255, 255)), (4, 1, (255, 255, 255)),
Exemple #7
0
 def shift_frame(self):
     self.message_matrix.shift_horizontal(True, Matrix(self.height, 1))