Menu

#1723 Gaps in Line sections

obsolete: 8.5a2
open
7
2007-08-19
2004-06-17
Rob Maris
No

Platform: windows (note: bug also appears in v8.4.6)
When I have created two or more lines on a canvas, and
these lines are "growing" by means of successive insert
actions, gaps in line sections may occur under the
following conditions (here two lines are supposed):

- Between any coordinate insert action of both lines the
Tk Mainloop must have been active.
- Coordinates must be non-integer with non-zero
fractional part (at least one of the coordinates).
- Only the LOWEST line (higher y-coordinate) is prone to
this behaviour.

The lines will automatically refresh without gaps when
another window will be moved over the lines, regardless
whether it is a Tk window or not.

Attached is a PNG of an example output with two
crossing lines. Interestingly: after the line crossing, all is
well (but I also have obeyed further gaps in the line
which is lowest).

Here's the test code that results in the attached output:

#console show
# test file to show line drawing errors
canvas .c -width 500 -height 200 -bg white
-highlightthickness 0
#pack [button .b -text start -command {plotlines .c}]
pack .c

proc plotlines {w} {
$w delete line
set id1 [$w create line 0 0 0 0 -fill red -tags line]
set id2 [$w create line 0 199 0 199 -fill blue -tags
line]
set n 0
for {set x 0} {$x < 450} {incr x 2} {
$w insert $id1 end "$x [expr {$n/5.0}]"
$w insert $id2 end "$x [expr {199 - ($n/5.0)}]"
incr n 4
update
}
}

plotlines .c

Note: the behaviour has been discovered in a datalogger
application where several channels are supplying data
via a com port. The data is retrieved event driven using
a fileevent setup. The code above lacks this event drive.
To achieve the erroneous result, an "update" command
is used. The window must be visible during the plotlines
call.

Discussion

  • Rob Maris

    Rob Maris - 2004-06-17

    screen shot

     
  • Rob Maris

    Rob Maris - 2004-06-17
    • milestone: --> obsolete: 8.5a2
     
  • Donal K. Fellows

    Logged In: YES
    user_id=79902

    Could it be a bounding-box off-by-one error?

     
  • Rob Maris

    Rob Maris - 2004-06-17

    Logged In: YES
    user_id=968757

    Please explain what you mean. I don't understand
    "bounding-box off-by-one".

    BTW: would anyone be so kind to check this bug under unix?

     
  • Donal K. Fellows

    • priority: 5 --> 7
     
  • Donal K. Fellows

    Logged In: YES
    user_id=79902
    Originator: NO

    Confirmed with HEAD on WinXP. Still think it's a bounding box error, or maybe a bounding box coordinate rounding error...

    When the canvas redraws itself properly, the gaps disappear.