fix.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. #!/usr/bin/python3
  2. import time
  3. import traceback
  4. boot = time.time()
  5. from collections import OrderedDict
  6. import random
  7. import os
  8. import sys
  9. #sys.path.insert(0,os.path.realpath(os.getcwd() + '/..'))
  10. sys.path.insert(0,"/opt/LibreLight/Xdesk/")
  11. print(sys.path)
  12. print()
  13. import pathlib
  14. _file_path=pathlib.Path(__file__)
  15. print("file:",_file_path)
  16. import tool.movewin as movewin
  17. pids = movewin.search_process(_file_path)
  18. CAPTION = 'LibreLight SDL-FIXTURE '
  19. if len(pids) >= 2:
  20. search = CAPTION[:]
  21. _ids = movewin.winfo(search)
  22. for _id in _ids:
  23. c3 = movewin.activate(_id)
  24. os.system(c3)
  25. sys.exit()
  26. # ===== GUI =========
  27. import pygame
  28. import pygame.gfxdraw
  29. import pygame.font
  30. pg = pygame
  31. main_size=(850,460)
  32. window = pygame.display.set_mode(main_size,pg.RESIZABLE,32)
  33. pg = pygame
  34. pygame.init()
  35. pygame.mixer.quit()
  36. clock = pygame.time.Clock()
  37. icon = pygame.image.load('icon/scribble.png')
  38. pygame.display.set_icon(icon)
  39. import tool.movewin as movewin
  40. import tool.sdl_elm as sdl_elm
  41. #CAPTION = 'LibreLight DMX '
  42. CAPTION += ':{}'.format(random.randint(100,999))
  43. import tool.git as git
  44. CAPTION += git.get_all()
  45. _id = movewin.winfo(CAPTION)
  46. c1 = movewin.movewin(_id,main_size[0],main_size[1]) #800,500)
  47. os.system(c1)
  48. c1 = movewin.activate(_id)
  49. os.system(c1)
  50. pg.display.set_caption(CAPTION)
  51. font0 = pygame.font.SysFont("freesans",10)
  52. font0b = pygame.font.SysFont("freesansbold",10)
  53. font = pygame.font.SysFont("freemonobold",22)
  54. font10 = pygame.font.SysFont("freemonobold",10)
  55. font12 = pygame.font.SysFont("freemonobold",12)
  56. font15 = pygame.font.SysFont("freemonobold",15)
  57. font16 = pygame.font.SysFont("freemonobold",16)
  58. font22 = pygame.font.SysFont("FreeSans",22)
  59. #font = pygame.font.SysFont(None,30)
  60. fr = font.render("hallo" ,1, (200,0,255))
  61. mouse_down = 0
  62. mouse_pos1 = [0,0]
  63. mouse_pos2 = [0,0]
  64. mouse_grab = []
  65. print(int((time.time()-boot)*10),"loop...")
  66. fps_t = time.time()
  67. fps = 0
  68. fps_old = 0
  69. import memcache
  70. mc = memcache.Client(['127.0.0.1:11211'], debug=0)
  71. mc.set("some_key", "Some value")
  72. value = mc.get("some_key")
  73. mc.set("another_key", 3)
  74. mc.delete("another_key")
  75. import time
  76. import json
  77. data = {}
  78. start = time.time()
  79. delta = start
  80. #for i in dir(mc):
  81. # print(i)#,[i.__doc__])
  82. # print()
  83. #for i in mc.get_stats():
  84. # print("keys",i)
  85. #fps_btn = []
  86. #fps_btn_press = []
  87. #i += 1
  88. #bx = sdl_elm.Button(window,pos=[30,r,190,60])
  89. #bx.text = "FIX:{}\n<val>\nx".format(i+1)
  90. #bx.font0 = pygame.font.SysFont("freesans-bold",20)
  91. #bx.btn1.type = "flash"
  92. #fps_btn.append(bx)
  93. #r+=bx.get_rect()[3]
  94. def read_dmx():
  95. dmx = {} #univ
  96. iii = 0
  97. y=mc.get("index")
  98. key=y.keys()
  99. key = list(key)
  100. key.sort()
  101. for k in key:
  102. if k.startswith("ltp-out"):
  103. #v = y[k]
  104. u = k.split(":")[-1]
  105. x=mc.get(k)
  106. dmx[u] = x
  107. return dmx
  108. def read_fix(dmx):
  109. y=mc.get("fix")#cmd)
  110. key=y.keys()
  111. key = list(key)
  112. key.sort()
  113. for k in key:#y.items():
  114. v = y[k]
  115. #print(k,v)
  116. x=mc.get(k)
  117. dmx_start = 0
  118. if "DMX" in v:
  119. dmx_start = v["DMX"]
  120. univ_start = 0
  121. if "UNIVERS" in v:
  122. univ_start = v["UNIVERS"]
  123. if "ATTRIBUT" in v: # and 10:
  124. ATTR = v["ATTRIBUT"]
  125. for k2 in ATTR:
  126. k2_ATTR = ATTR[k2]
  127. #print(ATTR) #[k2_ATTR]) #["VALUE2"] = -2
  128. k2_ATTR["VALUE2"] = -2
  129. #if k2.endswith("-FINE"):
  130. # continue
  131. if k2.startswith("_"):
  132. continue
  133. k3 = k+"-"+k2
  134. dmx_nr = 0
  135. if "NR" in k2_ATTR:
  136. if k2_ATTR["NR"] >= 1:
  137. dmx_nr = k2_ATTR["NR"]+1
  138. val2 = ""
  139. if "VALUE" in k2_ATTR:
  140. val2 = k2_ATTR["VALUE"]
  141. dmx_val=-1
  142. dmx_x=-1
  143. if dmx_nr > 0 and dmx_start > 0:
  144. try:
  145. dmx_x = dmx_start-1+dmx_nr-1
  146. dmx_val = dmx[str(univ_start)][dmx_x-1]
  147. except:pass
  148. if type(dmx_val) in [int,float]:
  149. k2_ATTR["VALUE2"] = dmx_val
  150. else:
  151. k2_ATTR["VALUE2"] = 0
  152. return y
  153. def add_dmx(data,dmx):
  154. pass
  155. def reorder_table_by_pos(table_grid):
  156. if type(table_grid) in (dict,OrderedDict):
  157. # order table of type dict by pos [x,y]
  158. table_grid5 = {}
  159. for t5 in table_grid:
  160. t5_row = table_grid[t5]
  161. print(t5,t5_row.pos)
  162. k5 = "{:010}-{:010}".format(t5_row.pos[0],t5_row.pos[1])
  163. table_grid5[k5] = [t5,t5_row]
  164. ordered = list(table_grid5.keys())
  165. ordered.sort()
  166. table_grid2 = OrderedDict()
  167. for k5 in ordered: #table_grid5:
  168. k5_row = table_grid5[k5]
  169. table_grid2[k5_row[0]] = k5_row[1]
  170. return table_grid2
  171. if type(table_grid) is list:
  172. # order table of type list by pos [x,y]
  173. table_grid5 = {}
  174. for t5 in table_grid:
  175. t5_row = t5 #table_grid[t5]
  176. print(t5)#,t5_row.pos)
  177. k5 = "{:010}-{:010}".format(t5_row.pos[1],t5_row.pos[0])
  178. table_grid5[k5] = [t5,t5_row]
  179. ordered = list(table_grid5.keys())
  180. ordered.sort()
  181. table_grid2 = [] #OrderedDict()
  182. for k5 in ordered: #table_grid5:
  183. k5_row = table_grid5[k5]
  184. table_grid2.append( k5_row[1] )
  185. return table_grid2
  186. return table_grid
  187. table={}
  188. table_grid={}
  189. btn1_press = [] #["10.10.10.13:0"]
  190. y=[]
  191. bx_font0 = pygame.font.SysFont("freesans-bold",20)
  192. import lib.zchat as chat
  193. cmd_client = chat.Client(port=30003)
  194. err = []
  195. err.append([time.time(),"init"])
  196. while 1:
  197. try:
  198. fps +=1
  199. t = time.time()
  200. if t-fps_t >= 1:
  201. #print("FPS:",fps)
  202. fps_old = fps
  203. fps=0
  204. fps_t =t
  205. pygame.display.flip()
  206. pos = [160,10,70,60]
  207. rgb = (0xdd,0xdd,0xdd,0)
  208. rgb = (0xaa,0xaa,0xaa,0)
  209. window.fill((5,5,5))
  210. pygame.draw.rect(window,(0,0,0),[0,0,main_size[0],main_size[1]])
  211. fr = font22.render("FIXTURE DATA (READONLY!)" ,1, (200,200,200))
  212. window.blit(fr,(20,10 ))
  213. fr = font22.render("DEMO / TEST - MODE ! " ,1, (200,200,200))
  214. #window.blit(fr,(10,30 ))
  215. pos = [160,110,70+80,20]
  216. #pygame.draw.rect(window,rgb,pos)
  217. t=(time.time()-start)
  218. if t > 15:
  219. start = time.time()
  220. b= 80-int(t*10)
  221. pos = [160,110,70+(b),20]
  222. rgb = (0x00,0xff,0xff,0)
  223. dmx = read_dmx()
  224. rgb = (0xff,0,0xaa,0)
  225. data = read_fix(dmx)
  226. #data = add_dmx(data,dmx)
  227. i = 0
  228. r=40
  229. if 1:
  230. ch = 141
  231. send = 0
  232. #cmd="stats items"
  233. #if not y:
  234. y=data #mc.get("fix")#cmd)
  235. if y:
  236. iii = 0
  237. key=y.keys()
  238. key = list(key)
  239. key2 = []
  240. for k in key:
  241. try:
  242. key2.append(int(k))
  243. except:
  244. pass
  245. key2.sort()
  246. key = key2 #.sort()
  247. if len(btn1_press) == 0:
  248. btn1_press = [key[0]]
  249. rgb = (0x00,0,0xff,0)
  250. k2 = btn1_press[-1]
  251. fr = font22.render("SRC:"+str(k2) ,1, rgb) #(200,200,200))
  252. window.blit(fr,(400,1))
  253. fr = font22.render("FPS:"+str(fps_old) ,1, rgb) #(200,200,200))
  254. window.blit(fr,(600,1))
  255. err_r = 0
  256. if err:
  257. for e in err:
  258. rgb = (255,0,0)
  259. fr = font22.render("err:"+str(e) ,1, rgb) #(200,200,200))
  260. window.blit(fr,(700,1+err_r))
  261. err_r += 20
  262. for k in key:#y.items():
  263. k = str(k)
  264. v = y[k]
  265. attr_count = 0
  266. if "ATTRIBUT" in v:
  267. for ATTR in v["ATTRIBUT"]:
  268. if ATTR.startswith("_"):
  269. continue
  270. if ATTR.endswith("-FINE"):
  271. continue
  272. if ATTR == "DIM":
  273. continue
  274. attr_count += 1
  275. if attr_count <= 0:
  276. continue
  277. #print(k,v)
  278. x=mc.get(k)
  279. cccount = 0
  280. txt = str([k,v,ch,"=",cccount]) #x[ch-1]])
  281. rgb = (0xaa,0xaa,0xaa,0)
  282. i += 1
  283. if k not in table:
  284. bx = sdl_elm.Button(window,pos=[20,r,50,20])
  285. bx.btn1.color_on = [255,255,0]
  286. table[k] = bx
  287. bxc = sdl_elm.Button(window,pos=[-11,r,5,20])
  288. bxc.btn1.color_on = [255,255,0]
  289. table[k+"_color"] = bxc
  290. bx = table[k]
  291. bx.data = v
  292. bxc.data = {}
  293. active = 0
  294. if "ATTRIBUT" in v:
  295. if "_ACTIVE" in v["ATTRIBUT"]:
  296. if "ACTIVE" in v["ATTRIBUT"]["_ACTIVE"]:
  297. if v["ATTRIBUT"]["_ACTIVE"]["ACTIVE"] >=1:
  298. active = 1
  299. bx.btn1.val.set(active)
  300. bx.text = "ID:"+ k #str(txt) #+"\n<val>\n" #.format(i+1)
  301. bx.font0 = bx_font0 #pygame.font.SysFont("freesans-bold",20)
  302. bx.btn1.bg_on = [0,255,255]
  303. bx.btn1.type = "toggle"
  304. bx.pos = [10,r,70,20]
  305. if "ATTRIBUT" in v:
  306. bcv_r = 0
  307. bcv_g = 0
  308. bcv_b = 0
  309. if "RED" in v["ATTRIBUT"]:
  310. bcv_r = v["ATTRIBUT"]["RED"]["VALUE2"]
  311. if "GREEN" in v["ATTRIBUT"]:
  312. bcv_g = v["ATTRIBUT"]["GREEN"]["VALUE2"]
  313. if "BLUE" in v["ATTRIBUT"]:
  314. bcv_b = v["ATTRIBUT"]["BLUE"]["VALUE2"]
  315. #print("bvc_rgb" [bcv_r,bcv_g,bcv_b])
  316. if bcv_r > 255:
  317. bcv_r=255
  318. if bcv_g > 255:
  319. bcv_g=255
  320. if bcv_b > 255:
  321. bcv_b=255
  322. bxc.btn1.color = [bcv_r,bcv_g,bcv_b]
  323. bxc.btn1.color_on = [bcv_r,bcv_g,bcv_b]
  324. bxc.pos = [85,r,20,20]
  325. bxc.text = ""
  326. bx.draw()
  327. bxc.draw()
  328. r_buf=bx.get_rect()[3]+2
  329. iii += 35
  330. rr = 0
  331. if "ATTRIBUT" in v: # and 10:
  332. ATTR = v["ATTRIBUT"]
  333. for k2 in ATTR:
  334. k2_ATTR = ATTR[k2]
  335. if k2.endswith("-FINE"):
  336. continue
  337. if k2.startswith("_"):
  338. continue
  339. k3 = k+"-"+k2
  340. val2 = ""
  341. if "VALUE" in k2_ATTR:
  342. val2 = k2_ATTR["VALUE"]
  343. virt = 1
  344. if "NR" in k2_ATTR:
  345. if k2_ATTR["NR"] > 0:
  346. virt = 0
  347. dmx_val = -3
  348. if "VALUE2"in k2_ATTR:
  349. dmx_val = k2_ATTR["VALUE2"]
  350. if k3 not in table_grid:
  351. bx = sdl_elm.Button(window,pos=[300,rr,60,20])
  352. bx.btn1.color_on = [255,255,0]
  353. bx.ID = 0
  354. if "ID" in v:
  355. bx.ID = v["ID"]
  356. bx.ATTR = k2
  357. table_grid[k3] = bx
  358. #table_grid = reorder_table_by_pos(table_grid)
  359. if "ACTIVE" in k2_ATTR:
  360. if k2_ATTR["ACTIVE"] >=1:
  361. table_grid[k3].btn1.val.set(1)
  362. else:
  363. table_grid[k3].btn1.val.set(0)
  364. bx = table_grid[k3]
  365. bx.data = k2_ATTR
  366. try:val = v
  367. except:pass
  368. bx.text = k2 +" "+str(val2)+" "+str(dmx_val)
  369. bx.font0 = bx_font0
  370. if k2 == "RED":
  371. bx.btn4.color_on = [255,0,0]
  372. elif k2 == "GREEN":
  373. bx.btn4.color_on = [0,255,0]
  374. elif k2 == "BLUE":
  375. bx.btn4.color_on = [0,0,255]
  376. if virt == 1:
  377. bx.btn3.color= [0,0,0]
  378. bx.btn1.type = "toggle"
  379. if type(dmx_val) == int:
  380. bx.btn4.val.set(dmx_val) # "toggle"
  381. bx.pos = [100+rr,r,120,20]
  382. bx.draw()
  383. rr+=bx.get_rect()[2]+2
  384. if rr > 1000:
  385. break
  386. r += r_buf
  387. if r > 800:
  388. break
  389. resize_changed = 0
  390. for event in pygame.event.get():
  391. #print(event.dict)
  392. #print(event.type)
  393. if "scancode" in event.dict:
  394. if event.scancode == 9:
  395. for k in table:
  396. t = table[k]
  397. #t.btn2.clean()
  398. t.btn1.clean()
  399. for k in table_grid:
  400. t = table_grid[k]
  401. #t.btn2.clean()
  402. t.btn1.clean()
  403. msg=json.dumps([{"event":"CLEAR"}]).encode("utf-8")
  404. print("ESC",msg)
  405. cmd_client.send(msg)
  406. print("event",event)
  407. if event.type == pygame.QUIT:
  408. pygame.quit()
  409. sys.exit(0)
  410. elif event.type == pygame.VIDEORESIZE:
  411. scrsize = event.size
  412. width = event.w
  413. hight = event.h
  414. resize_changed = True
  415. for t in table:
  416. #print(t)
  417. table[t].event(event)
  418. if table[t].btn3.get():
  419. data = table[t].data
  420. print("FIX:",data)
  421. for t in table_grid:
  422. #print(t)
  423. change = table_grid[t].event(event)
  424. if table_grid[t].btn3.get():
  425. data = table_grid[t].data
  426. FIX = table_grid[t].ID
  427. ATTR = table_grid[t].ATTR
  428. #print("change",change)
  429. key = "MOUSE ENCODER"
  430. if key in change:
  431. if "press" in change[key]:
  432. msg = json.dumps([{"event":"FIXTURES","TYPE":"ENCODERS","FIX":str(FIX),"VAL":"++","ATTR":ATTR}]).encode("utf-8")
  433. if "release" in change[key]:
  434. msg = json.dumps([{"event":"FIXTURES","TYPE":"ENCODERS","FIX":str(FIX),"VAL":"--","ATTR":ATTR}]).encode("utf-8")
  435. print(" ",msg)
  436. cmd_client.send(msg)
  437. key = "BUTTON"
  438. if key in change:
  439. if "press" in change[key]:
  440. #print(" ATTR:",FIX,ATTR,data)
  441. #print(" CHANGE",change)
  442. msg = json.dumps([{"event":"FIXTURES","TYPE":"ENCODERS","FIX":str(FIX),"VAL":"click","ATTR":ATTR}]).encode("utf-8")
  443. print(" ",msg)
  444. cmd_client.send(msg)
  445. if "release" in change[key]:
  446. pass
  447. if "pos" in event.dict:
  448. if "button" in event.dict:
  449. if event.type == 5:#press
  450. mouse_down = 1
  451. mouse_pos1 = [event.pos[0],event.pos[1]]
  452. if event.type == 6:#release
  453. mouse_down = 0
  454. #for btn in mouse_grab:
  455. # btn.btn1.val.set(1)
  456. mouse_pos2 = [event.pos[0],event.pos[1]]
  457. if "button" in event.dict:
  458. if event.type == 6:
  459. #print("grab DOOOO",event)
  460. #print("grab2", event.dict["button"],len(mouse_grab) )
  461. if event.dict["button"] == 1:
  462. mouse_grab_active = 0
  463. for mg in mouse_grab:
  464. if mg.btn1.val.get():
  465. mouse_grab_active += 1
  466. for mg in mouse_grab:
  467. FIX = str(mg.ID)
  468. ATTR = str(mg.ATTR)
  469. if mouse_grab_active:
  470. if not mg.btn1.val.get():
  471. msg = json.dumps([{"event":"FIXTURES","TYPE":"ENCODERS","FIX":str(FIX),"VAL":"click","ATTR":ATTR}]).encode("utf-8")
  472. print(" mouse_grab ",msg,mg.btn1.val.get())
  473. cmd_client.send(msg)
  474. else: #no btn is on
  475. msg = json.dumps([{"event":"FIXTURES","TYPE":"ENCODERS","FIX":str(FIX),"VAL":"click","ATTR":ATTR}]).encode("utf-8")
  476. #amsg = json.dumps([{"event":"FIXTURES","TYPE":"ENCODERS","FIX":str(FIX),"VAL":"click","ATTR":ATTR}]).encode("utf-8")
  477. print(" mouse_grab OFF ",msg,mg.btn1.val.get())
  478. cmd_client.send(msg)
  479. mouse_grab = []
  480. if event.dict["button"] == 3:
  481. mouse_grab_active = 0
  482. for mg in mouse_grab:
  483. if mg.btn1.val.get():
  484. mouse_grab_active += 1
  485. for mg in mouse_grab:
  486. FIX = str(mg.ID)
  487. ATTR = str(mg.ATTR)
  488. if mouse_grab_active:
  489. if mg.btn1.val.get():
  490. msg = json.dumps([{"event":"FIXTURES","TYPE":"ENCODERS","FIX":str(FIX),"VAL":"click","ATTR":ATTR}]).encode("utf-8")
  491. print(" mouse_grab ",msg,mg.btn1.val.get())
  492. cmd_client.send(msg)
  493. mouse_grab = []
  494. if mouse_down:
  495. d1 = mouse_pos1[0]-mouse_pos2[0]
  496. d2 = mouse_pos1[1]-mouse_pos2[1]
  497. pix = 10
  498. #print(d1,d2)
  499. if ( d1 > pix or d1 < -pix) or ( d2 >pix or d2 < -pix):
  500. sdl_elm.draw_mouse_box(window,mouse_pos1,mouse_pos2)
  501. for k in table: # FIX-ID
  502. t = table[k]
  503. pos = t.get_rect()
  504. mpos = [mouse_pos1[0],mouse_pos1[1],mouse_pos2[0],mouse_pos2[1]]
  505. if sdl_elm.check_area2(pos,mpos):
  506. #t._set_mouse_focus(1)
  507. if t not in mouse_grab:
  508. mouse_grab.append(t)
  509. print("mouse_grab.append",t)
  510. #mouse_grab = reorder_table_by_pos(mouse_grab)
  511. else:
  512. #t._set_mouse_focus(0)
  513. if t in mouse_grab:
  514. mouse_grab.remove(t)
  515. print("mouse_grab.remove",t)
  516. for k3 in table_grid: # FIX-ATTR
  517. t = table_grid[k3]
  518. pos = t.get_rect()
  519. mpos = [mouse_pos1[0],mouse_pos1[1],mouse_pos2[0],mouse_pos2[1]]
  520. if sdl_elm.check_area2(pos,mpos):
  521. #t._set_mouse_focus(1)
  522. if t not in mouse_grab:
  523. mouse_grab.append(t)
  524. print("mouse_grab.append",t)
  525. #mouse_grab = reorder_table_by_pos(mouse_grab)
  526. else:
  527. #t._set_mouse_focus(0)
  528. if t in mouse_grab:
  529. mouse_grab.remove(t)
  530. print("mouse_grab.remove",t)
  531. for k3 in table_grid:
  532. t = table_grid[k3]
  533. t._set_mouse_focus(0)
  534. i = 1
  535. if mouse_grab:
  536. mouse_grab = reorder_table_by_pos(mouse_grab)
  537. for t in mouse_grab:
  538. t._set_mouse_focus(1)
  539. pos = t.pos[:2]
  540. pos[0] += 100
  541. pos[1] += 8
  542. rgb = (0,255,255)
  543. fr = font15.render(""+str(i) ,1, rgb) #(200,200,200))
  544. #print(pos)
  545. pygame.draw.rect(window,(0,0,0),[pos[0]-2,pos[1]-2,15,13])
  546. window.blit(fr,pos)
  547. i+=1
  548. if resize_changed:# = True
  549. screen = pygame.display.set_mode(scrsize,pg.RESIZABLE)
  550. clock.tick(10)
  551. except Exception as e:
  552. err.append([int((time.time()-boot)*100),e])
  553. traceback.print_exc()
  554. print("Exc",e)