#!/usr/bin/env python3 import os import sys import time Nx = int(sys.argv[1]) Ny = int(sys.argv[2]) p1 = 20 p2 = 10 try: param = sys.argv[3] p = param.split(",") p1 = int(p[0]) p2 = int(p[1]) except: pass buffera = bytearray(b"\x00" * (3 * Nx * Ny)) bufferb = bytearray(b"\xFF" * (3 * Nx * Ny)) cnt = 0 os.write(2,b"Usage: Parameter: \"20,10\"\n -> updates every 20*0.01s, every 10th frame is white") while True: os.write(1, buffera) time.sleep(p1*0.01) if cnt == p2-1: cnt = 0 os.write(1, bufferb) time.sleep(p1*0.01) cnt += 1