| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 | import pygameimport pygame.gfxdrawimport mathimport randomimport osos.environ['SDL_VIDEO_WINDOW_POS'] = '%i,%i' % (200,200)os.environ['SDL_VIDEO_CENTERED'] = '0'pg = pygamepygame.init()main_size=(600,300)main_size=(1600,900)main_size=(600,300)#window = pygame.display.set_mode(main_size,pygame.FULLSCREEN) #x left->right ,y top-> bottom#window = pygame.display.set_mode(main_size,pg.RESIZABLE|pygame.DOUBLEBUF,32)#,pygame.FULLSCREEN) #x left->right ,y top-> bottomwindow = pygame.display.set_mode(main_size,pg.RESIZABLE)#,32)#,pygame.FULLSCREEN) #x left->right ,y top-> bottom#window = pygame.display.set_mode(main_size,pg.NOFRAME,32)#,pygame.FULLSCREEN) #x left->right ,y top-> bottom#window = pygame.display.set_mode(main_size,pg.NOFRAME,32)#,pygame.FULLSCREEN) #x left->right ,y top-> bottom#window = pygame.display.set_mode(main_size,pygame.FULLSCREEN) #x left->right ,y top-> bottom# pygame.display.set_mode((self.width, int(self.height+(self.height*0.15))) ,pygame.FULLSCREEN)#pg.display.set_mode(window,pg.DOUBLEBUF) #|pg.OPENGL)pg.display.set_caption('LibreLight Animation')import pygameimport pygame.gfxdrawimport mathimport randomimport osdef event_read():    inc = 1    for event in pg.event.get():        print("event",event)        move_x = 0        move_y = 0        move_z = 0        rot_x = 0        rot_y = 0        rot_z = 0        if event.type== pg.QUIT:            print("quit")            pg.quit()            quit()            sys.exit()        if "key" in dir(event):            if event.key == 27: #ESC pg.KEYDOWN:                print("quit")                pg.quit()                quit()                sys.exit()pg = pygamepygame.init()main_size=(600,300)main_size=(1600,900)main_size=(600,300)#window = pygame.display.set_mode(main_size,pygame.FULLSCREEN) #x left->right ,y top-> bottom#window = pygame.display.set_mode(main_size,pg.RESIZABLE|pygame.DOUBLEBUF,32)#,pygame.FULLSCREEN) #x left->right ,y top-> bottomwindow = pygame.display.set_mode(main_size,pg.RESIZABLE)#,32)#,pygame.FULLSCREEN) #x left->right ,y top-> bottom#window = pygame.display.set_mode(main_size,pg.NOFRAME,32)#,pygame.FULLSCREEN) #x left->right ,y top-> bottom#window = pygame.display.set_mode(main_size,pg.NOFRAME,32)#,pygame.FULLSCREEN) #x left->right ,y top-> bottom#window = pygame.display.set_mode(main_size,pygame.FULLSCREEN) #x left->right ,y top-> bottom# pygame.display.set_mode((self.width, int(self.height+(self.height*0.15))) ,pygame.FULLSCREEN)#pg.display.set_mode(window,pg.DOUBLEBUF) #|pg.OPENGL)pg.display.set_caption('LibreLight Animation')class FIX():    def __init__(self,pos=[10,10]):        self.rgb = [255,255,255]        self.pos = pos    def draw(self):        pygame.draw.rect(window,self.rgb,[self.pos[0],self.pos[1],15,15])import memcachemc = memcache.Client(['127.0.0.1:11211'], debug=0)import times=time.time()import mathwhile 1:    x=mc.get("index")#cmd)    #for i,k in x.items():    #    print(i,k)    t = int(math.sin(time.time() - s)*10)    event_read()    #r=mc.get("10.10.10.13:2")    r = mc.get("2.0.0.13:2")    if not r:        c = 0        time.sleep(0.1)        r = [0] *512        #for i in range(12+1):        #    for j in range(8+1):        #        dmx = i*j*4 #*j*4        #        if c == 1:        #            col = [255,255,0,0]        for i in range(12*8+1):            dmx = i*4            r[dmx:dmx+4] = [255,10,10,40]     #print(r)    ch = 0    dmx = 1-1    rgb = [255,255,255]    for x in range(12):        for y in range(8):            ch += 4            #f = FIX(pos=[x*16,y*16])            if ch+4 < len(r):                rgb = [r[ch+1]*r[ch]/255,r[ch+2]*r[ch]/255,r[ch+3]*r[ch]/255]                #print(rgb)            pos=[x*16,y*16]            pygame.draw.rect(window,rgb,[pos[0],pos[1],15,15])            #f.draw()    pygame.display.flip()    pg.time.wait(10)
 |