From: Joe Van Dyk Date: 2005-07-13T02:55:54+09:00 Subject: Updating GUIs Hi, I'm still fairly new to writing GUIs. A common approach to me is to write some model classes that have a function called "update". That function should get called a few times a second, and then the GUI should get updated reflecting those changes. What's the best way to do this? Should I have a Ruby thread that calls the update function, sleeps for 0.2 seconds, and then loops? How should the GUI get notified of those changes? For discussion purposes, say I have class Player attr_accessor :x_position, :y_position, :player_type # just a data store end class PlayerList attr_accessor :players def initialize @players = [Player.new, Player.new, Player.new] end def update # update goes out and updates the x and y position end end And then the GUI knows about PlayerList and needs to display updated information on each Player (move a player icon on a map, update tabular data, that kind of thing). I could have up to 500 players, and the application isn't supposed to be terribly CPU intensive, so performance can be an issue.