Advertisement
Good_Pudge

GPGUI Demo

Jan 23rd, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. package.loaded.gpgui = nil
  2. local gpgui = require("gpgui")
  3.  
  4. local f = gpgui.newForm()
  5. local bs = {}
  6. local col = {"FF","4B","00"}
  7.  
  8. function cols()
  9.   local c1 = col[math.random(1,#col)]
  10.   local c2 = col[math.random(1,#col)]
  11.   local c3 = col[math.random(1,#col)]
  12.   return tonumber("0x"..c1..c2..c3)
  13. end
  14.  
  15. for i=1,10 do --для дохуищи кнопок
  16.   bs["b"..i] = gpgui.newButton()
  17.   bs["b"..i]:setPos(i*2,i*2)
  18.   bs["b"..i]:setColors(cols(),cols())
  19.   bs["b"..i]:setActiveColors(cols(),cols())
  20.   bs["b"..i]:setFunc(function() print(i*i); end)
  21.   f:add(bs["b"..i])
  22. end
  23. local b11 = gpgui.newButton()
  24. b11:setValue("ВЫЙТИ")
  25. b11:setSize(5,3)
  26. b11:setPos(74,37)
  27. b11:setFunc(function() require("term").clear();os.exit() end)
  28. b11:setColors(0xFF4B4B,0x4BFFFF)
  29.  
  30. bs["b1"]:setFunc(function() print(os.date()) end)
  31. bs["b2"]:setFunc(function() print(os.time()) end)
  32. bs["b3"]:setFunc(function() print(cols()) end)
  33. f:add(b11)
  34. f:draw()
  35.  
  36. local l = gpgui.newLabel()
  37. l:setValue("Дата")
  38. l:setPos(4,3)
  39. f:add(l)
  40. f:draw()
  41. l:setValue("Время")
  42. l:setPos(8,7)
  43. f:draw()
  44. gpgui.listen()
  45. f:listen()
  46. gpgui.ignore()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement