Created
March 30, 2012 08:46
-
-
Save smits/2249915 to your computer and use it in GitHub Desktop.
rttlua GUI example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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