[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ruby tk drawing a line

Edward Redman

10/12/2007 3:47:00 AM

I have a question concerning ruby/tk and drawing lines on a canvas.
I tried to convert from a tcl program.
Everything works fine except that the line when its thickness is large
appears to be a series of short line segments rather than a solid line.

I have binded the "1" mouse button to start the line with the following

canvas.bind( '1', proc { |e|

$startx = e.x
$starty = e.y

})

and the motion of the mouse

canvas.bind('B1-Motion', proc { |e|
$endx = e.x
$endy = e.y

$a = TkcLine.new(canvas, $startx, $starty, $endx, $endy)
$a.width option.value
$a.fill "#{color}"
})

Can anyone see why this does not give me a solid line


--
Ed Redman
redman@accesswave.ca
2 Answers

Joel VanderWerf

10/12/2007 4:32:00 AM

0

Ed Redman wrote:
> I have a question concerning ruby/tk and drawing lines on a canvas.
> I tried to convert from a tcl program.
> Everything works fine except that the line when its thickness is large
> appears to be a series of short line segments rather than a solid line.
>
> I have binded the "1" mouse button to start the line with the following
>
> canvas.bind( '1', proc { |e|
>
> $startx = e.x
> $starty = e.y
>
> })
>
> and the motion of the mouse
>
> canvas.bind('B1-Motion', proc { |e|
> $endx = e.x
> $endy = e.y
>
> $a = TkcLine.new(canvas, $startx, $starty, $endx, $endy)
> $a.width option.value
> $a.fill "#{color}"
> })
>
> Can anyone see why this does not give me a solid line

Does the same thing happen without the fill param?

A TkcLine has a "dash" parameter, and that might be causing this. But it
would be surprising if the default is a dashed line. Anyway, you could try

$a.dash ""

or

$a.dash nil

See

http://www.tcl.tk/man/tcl8.4/TkCmd/canv...

for details.

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Hidetoshi NAGAI

10/12/2007 4:43:00 AM

0