From: brabuhr@... Date: 2009-12-05T01:55:07+09:00 Subject: Re: Graphics mode again On Fri, Dec 4, 2009 at 11:12 AM, Teodor Carstea wrote: > It works! As you said, a single ball on the screen. > > Question 1: what kind of parameters a these: > >>:x1 => 10, :y1 => 10, >>:x2 => 20, :y2 => 20, > > is it a kind of width/height? which variables point to the center of da > ball,? I need it in order to manage its position using the coordinates. Assuming you had the center of the ball in instance variables @x and @y: :x1 => @x - 5, :y1 => @y - 5, :x2 => @x + 5, :y2 => @y + 5, > Question 2: > > what method like "repaint()" or "clrscr()" or "cleardevice()" could I > use in Ruby to make the ball dissappear? I don't know, that's the first ruby-gnome code I've written. Looking at the clock example, I made a change: #!/usr/bin/env ruby require 'gnomecanvas2' class Foozle < Gtk::Window def initialize super @canvas = Gnome::Canvas.new(true) @foozle = Gnome::CanvasEllipse.new( @canvas.root, { :x1 => 10, :y1 => 20, :x2 => 30, :y2 => 40, :fill_color => "white", :outline_color => "steelblue", :width_pixels => 1 } ) @canvas.show add(@canvas) Gtk::timeout_add(1000) { @foozle.x1-=5; true } Gtk::timeout_add(1100) { @foozle.y1-=5; true } Gtk::timeout_add(1200) { @foozle.x2+=5; true } Gtk::timeout_add(1300) { @foozle.y2+=5; true } Gtk::timeout_add(9000) { @foozle.hide } end end Gtk.init(); Foozle.new.show; Gtk.main()