Tk Library Source Code

View Ticket
Login
Ticket UUID: 1571af09d85c94dcd4ebb474e364d2c7bafb3f5b
Title: canvas: bugs found by the new tests
Type: Bug Version: trunk
Submitter: serhiy.storchaka Created on: 2026-11-21 18:08:46
Subsystem: tklib :: canvas Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Open Last Modified: 2026-11-22 16:44:35
Resolution: None Closed By: nobody
    Closed on:
Description:

The bugs below were found by the tests in branch tests-canvas; each is covered by a test with the knownBug constraint (canvas::drag-4.5, canvas::edit::points-2.4, 2.6, 2.7, 2.8, 2.10, 3.8, 6.7, 7.1, canvas::edit::circle-2.4, 2.6, 4.3, 6.4, canvas::edit::rectangle-2.4, 2.6, canvas::edit::polyline-2.4, 2.6, 6.7, canvas::edit::quadrilateral-2.4, 2.8, 4.6, 4.7, canvas::mvg-1.4, 2.22, canvas::sqmap-2.2, 2.9, 3.1, 3.4, 4.9, canvas::zoom-2.10, 4.8, 7.2). All of them occur with Tk 8.6 and 9.1.

canvas::drag

  • canvas::drag off .c tag for a tag without a drag set up fails with can't read "attached(.c tag)": no such element in array. The manual page says it "removes any drag operation set on the items" and returns the empty string. (canvas::drag-4.5)

canvas::edit editors

  • The editors (points, circle, rectangle, polyline, quadrilateral) are not active after creation: E active returns 0 and no bindings are installed until E enable is called. The manual pages say that enabled editing "is the default after instance creation". The call that would install the bindings is commented out in the constructor of canvas::edit::points. (canvas::edit::points-2.4, circle-2.4, rectangle-2.4, polyline-2.4, quadrilateral-2.4)
  • E cget -create-cmd fails with unknown subcommand "UnChain": must be cget for the circle, rectangle and polyline editors: the option is declared with -cgetmethod UnChain, but the method is named Unchain. (canvas::edit::circle-2.6, rectangle-2.6, polyline-2.6)
  • canvas::edit points: E destroy fails with wrong # args: should be "... Bindings Remove parts" unless exactly one of drag and edit is enabled, because the destructor calls $self Bindings Remove {*}$mybound. So it fails on a new editor and after a plain E enable. (canvas::edit::points-2.6, 2.7, 2.8)
  • canvas::edit points: E enable drag; E enable edit; E disable leaves the drag bindings (<Button-3>, <B3-Motion>, <ButtonRelease-3>) on the points, because each enable replaces the list of bound parts instead of adding to it. (canvas::edit::points-3.8)
  • canvas::edit points: the manual page says that -data-cmd can only be set at construction time, but E configure -data-cmd x is accepted (the option is not -readonly, unlike -tag, -add-remove-point and -drag-point). (canvas::edit::points-2.10)
  • canvas::edit points: the manual page describes -drag-point as an event specification with the default ButtonPress-3. The code default is 3, and canvas::drag only accepts ?modifier-?button: with -drag-point ButtonPress-3, E enable fails with bad button number "B3". (canvas::edit::points-6.7)
  • canvas::edit points: E configure -mode foo fails with missing close-bracket instead of bad option foo, expected one of ...: a bracket is missing in the command that builds the error message. (canvas::edit::points-7.1)
  • canvas::edit circle uses center and radius where the manual page uses the bounding box: the -data-cmd callback gets {{100.0 100.0} 30.0} instead of the documented list of min x, min y, max x, max y (70.0 70.0 130.0 130.0), and E set 40 40 60 60 (documented as set minx miny maxx maxy) fails with wrong # args: should be "E set center radius". (canvas::edit::circle-4.3, 6.4)
  • canvas::edit polyline: the first vertex added with E add x y is not reported to the -data-cmd callback (the notification is skipped while the line has fewer than 2 points), although the manual page says that add goes through -data-cmd. (canvas::edit::polyline-6.7)
  • canvas::edit quadrilateral E .c -highlight-cmd cmd fails with unknown option "-highlight-cmd": the option is passed to the internal canvas::edit points editor, which does not have it. (canvas::edit::quadrilateral-2.8)
  • canvas::edit quadrilateral: the default vertex markers have radius 5, the manual page says radius 3. (canvas::edit::quadrilateral-4.6)
  • canvas::edit quadrilateral: with the default highlighting the vertex under the mouse is not recolored in red as the manual page says, it stays SkyBlue2. (canvas::edit::quadrilateral-4.7)

canvas::mvg

  • canvas::mvg .c on an empty canvas fails with wrong # args: should be ".c bbox tagOrId ?tagOrId ...?" (bbox is called without arguments). (canvas::mvg-1.4)
  • canvas::mvg fails with unknown option "-image" on a canvas with a bitmap item: bitmap items are handled like image items. (canvas::mvg-2.22)

canvas::sqmap

  • A canvas::sqmap created without options raises the background error expected floating-point number but got "" (Tk 9.1: ... but got a list) in PixelToGrid as soon as it is mapped: the internal grid variables are only set by Reconfigure, which runs only when an option is changed. (canvas::sqmap-2.2)
  • Setting -grid-cell-command after creation does not request the images of the visible cells: the command is not called. (canvas::sqmap-3.1)
  • The -grid-cell-command callback is called with three additional arguments, get cellid result; the manual page says two, the cell id and the result command prefix. (canvas::sqmap-3.4)
  • .m flush without -grid-cell-command does not forget the images set with .m image set; the manual page says that in that case the canvas "will simply forget all images". (canvas::sqmap-4.9)

canvas::sqmap and canvas::zoom

  • Destroying a canvas::sqmap or canvas::zoom widget right after its creation raises the background error namespace "::uevent::onidle::Snit_instN" not found: the pending idle callbacks are not cancelled on destruction. (canvas::sqmap-2.9, canvas::zoom-7.2)

canvas::zoom

  • The user interface is only built when the widget is created without options, or when an option changes -orient, -levels or -variable: canvas::zoom .z -command cmd and canvas::zoom .z -orient vertical (the default value) create an empty widget. (canvas::zoom-2.10)
  • canvas::zoom .z -levels -1 is accepted; the manual page says the value is a non-negative integer. (canvas::zoom-4.8)

User Comments: serhiy.storchaka added on 2026-11-22 16:44:35:

Proposed fix for canvas::zoom created with options that do not change the display (e.g. -command), and for destroying it right after its creation, in branch canvas-zoom-build-ui.


serhiy.storchaka added on 2026-11-22 16:09:58:

Proposed fix for destroying the canvas::edit::points editors (and the editors built on it) in branch canvas-edit-points-destroy.