From: "csjasnoch@..." Date: 2005-11-11T06:22:14+09:00 Subject: Re: Scheudle display Looking at some other stuff this is what I came up with but I am stuck on the usage of TkcPolygon.new I do not understand what the coordianates are and how big the vector should/can be. I will need to have access to be able to call the addPoly function anytime a new event is set in my scheduler. So I would like to put a cone type shape over that time period. Example: Someone wants a schedule that is trigger on at 00:00 and off at 6:00 then on again at 12:00 then off again at 18:00. Each time they add these seperate events to the schedule a the canvas needs to adjusst its picutre accordingly. With this example in the end it would be divided evenly into 4 sections 0degrees to 90degrees would be red (or whatever color), as well as 180 to 270 degrees. The remaining sections would remain white (or whatever color is initialized). As i said i do not understand how TkcPolygon.new works though so I am initializing it with values that seem to be meaningless. I hope someone can help. Here is my adjusted code for adding a poly. require 'tk' class Clock def initialize @c = TkCanvas.new(:width=>400, :height=>400, :scrollregion=>[-200, -200, 200, 200]).pack oval = TkcOval.new(@c, [-150, -150], [150, 150], :fill=>'white') TkcOval.new(@c, [-5, -5], [5, 5], :fill=>'black') l = TkLabel.new(:text=>'00:00').pack oval.bind('Motion', proc{|x, y| l.text = '%02d:%02d' % coords_to_time(@c.canvasx(x), @c.canvasy(y)) }, '%x %y') end def coords_to_time(x, y) return ((y < 0)? [0, 0]: [12, 0]) if x == 0 hh, mm = (Math.atan(-y/-x.to_f) + Math::PI/2).divmod(Math::PI/12) [((x >= 0)? hh.to_i: (hh.to_i + 12)), (60 * mm).to_i] end def addPoly(coords) @coords = coords @poly = TkcPolygon.new(@c, @coords, :fill=>'red') end end coords = [[-5, -5], [5, 5], [100, 200],[100,100]] my_clock = Clock.new my_clock.addPoly(coords) Tk.mainloop