Skip to content

Instantly share code, notes, and snippets.

@smits
Created March 30, 2012 08:46
Show Gist options
  • Save smits/2249915 to your computer and use it in GitHub Desktop.
Save smits/2249915 to your computer and use it in GitHub Desktop.
rttlua GUI example
require 'qtcore'
require 'qtgui'
require 'os'
app = QApplication(select('#',...) + 1, {'lua', ...})
dp = rtt.getTC():getPeer('deployer')
dp:loadComponent('name','OCL::LuaComponent')
name = dp:getPeer('name')
name:exec_str('function updateHook() print(rtt.getTime()) end')
name:setPeriod(0.1)
name:configure()
name:start()
program = QString("rttlua")
arguments = QStringList()
arguments[1]="-i"
arguments[2]=""
btn = QPushButton("Hello World!")
btn:connect('2pressed()', app, '1quit()')
--timer= QTimer(parent)
--timer:connect('2timeout()', function() print(rtt.getTime()) end)
--timer:start(100)
btn:setWindowTitle("A great example!")
btn:resize(300,50)
btn:show()
app.exec()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment