Bauduin Raphael wrote: > Hi, > > Thanks for the tip about QProcess, I'll experiment with it later. > For the time being, I've implemented nobu nokada's suggestion. > > I still have the problem refreshing the widget though.... > > With this code: > > Thread.new("/tmp/test") do |f| > begin > tail = IO.popen("/usr/bin/tail -f #{f}","r") > while line = tail.gets > hello.append line.chomp > puts line.chomp > end > > ensure > puts "killing #{tail.pid}" > Process.kill("INT", tail.pid) > tail.close > end > end > > the while loops (updating the widget AND printing line in the terminal) > seems to be run only when activity occurs in the window (click, entering > window). > > How comes the line is printed in the terminal only when activity occurs > in the window? Ruby threads aren't compatible with QtRuby - you have to always use the same ruby thread to make Qt calls. Another approach would be to use a Qt::Timer to periodically poll for input from tail: lots 'input()' ef initialize() super() @timer = Qt::Timer.new connect(@timer, SIGNAL('timeout()'), SLOT('input()')) @timer.start(200) nd ef input # Read from the pipe, append text to the Qt::TextEdit widget nd -- Richard