class Iup::Timer

The timer is used to trigger a callback function at regular intervals without interrupting the application’s main event loop. It can be used to safely update the user interface.

For example, the following creates a timer which counts down from 10, updating a label’s title. When the count reaches 0, the application will close.

count = 10
timer = Iup::Timer.new do |t|
  t.time = 1000

  t.action_cb = ->{
    if count.zero?
      Iup::CLOSE
    else
      count -= 1
      label.title = "Time remaining: #{count}"
      Iup::DEFAULT
    end
  }
end