From: Johnny Johnnybgood Date: 2008-12-01T13:45:46+09:00 Subject: Re: Ruby Tk and X/Y coordinates Hidetoshi NAGAI wrote: > From: Johnny Johnnybgood > Subject: Ruby Tk and X/Y coordinates > Date: Sun, 30 Nov 2008 12:32:13 +0900 > Message-ID: >> with a little problem I'm having. I want to be able to draw X/Y >> coordinates on my screen using Tk library. I tried to decipher the docs > > What do you mean with the word "screen" ? > If you mean "draw lines or figures on the *application* window", > a canvas widget can help you. > Of course, you can convert screen (desktop) coordinates to > window coordinates, and control (move) Ruby/Tk windows by > screen coordinates. > But, if you mean "draw on the desktop directry", > it is not Ruby/Tk's business. What I'm trying to do is this: I have an array of x,y coordinates (example=[[0,0], [1,1], [2,2], [3,3], [50,50], etc]...I want my script to create an *application* window the size of my screen (1024, 768) and draw dots (pixels) at the X/Y coordinates provided by my array. I know that with lines, "to create a line, the one piece of information you'll need to specify is where the line should be. This is done by using the coordinates of the starting and ending point, expressed as a list of the form x0 y0 x1 y1." I guess if I set the x1 y1 to x0 y0 then I should just get dots and not lines (I don't know if that will even work but I'll test it). Is there an easier way (something that's specifically created for drawing x/y coordinates)? Thanks -- Posted via http://www.ruby-forum.com/.