123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- from pyray import *
- init_window(800, 450, "RAY-DMX")
- import time
- import memcache
- mc = memcache.Client(['127.0.0.1:11211'], debug=0)
- old_x = 0
- old_y = 0
- while not window_should_close():
- try:
- y=mc.get("index")
- begin_drawing()
- clear_background(BLACK)
- GREY = [122,122,122,255]
- p=0
- keys = []
- for k in y:
- keys.append(k)
- keys.sort()
- k=keys[2]
- xi=0
- yi=0
- for i,v in enumerate(range(20+1)):
- txt=str(i+1)
- draw_text(txt, 180+xi*30, 5+yi*13, 11, YELLOW)
- xi+=1
- if xi % 20 == 0:
- break
- xi=0
- yi=0
-
- for i,v in enumerate(mc.get(k)):
-
- txt = str(i)+":"+str(v)
- txt = str(v)
- x2 = 180+xi*30
- y2 = 25+yi*13
- try:
- draw_rectangle(x2-2, y2-2,24,13,[255,255,255,int(v)])
- except:
- draw_rectangle(x2-2, y2-2,24,13,[255,2,2,255])
- try:
- int(v)
- except:
- v=0
- if int(v) > 100:
- draw_text(txt, x2, y2, 11, BLACK)
- else:
- draw_text(txt, x2, y2, 11, GREY)
- xi+=1
- if xi % 20 == 0:
-
-
-
-
-
- draw_text(str(int(yi*20)+1), 170-30, y2, 11, YELLOW)
- xi = 0
- yi += 1
- draw_text(str(int(yi*20)+1), 170-30, y2, 11, YELLOW)
- p=0
- for k in keys:
-
- txt =":"+str(k)
- draw_text(txt, 10, 20+p, 20, GREY)
- p+=20
- x=100
- y=100
- w=200
- h=50
-
- x=200
- y=200
-
-
-
-
-
-
-
-
-
- m=get_mouse_position()
- if m.x != old_x or m.y != old_y:
- old_x = m.x
- old_y = m.y
- print(m.x,m.y)
- end_drawing()
- time.sleep(0.1)
- except KeyboardInterrupt as e:
- raise e
- except Exception as e:
- print("err",e)
- time.sleep(1)
-
- close_window()
|