Tk Library Source Code

View Ticket
Login
Ticket UUID: 9de803cd5480ff4175ed45068a08705f2b7dec3a
Title: tkpiechart does not work with Tcl 9
Type: Bug Version: trunk
Submitter: serhiy.storchaka Created on: 2026-11-21 13:13:32
Subsystem: tklib :: tkpiechart Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Open Last Modified: 2026-11-21 13:16:33
Resolution: None Closed By: nobody
    Closed on:
Description:

With Tcl/Tk 9 no pie can be created:

package require stooop
package require switched
package require tkpiechart
pack [canvas .c]
stooop::new pie .c 10 10
fails with can't read "switched::(1,complete)": no such variable.

There are two causes:

  • The classes refer to the data arrays of other classes with relative names, such as $switched::($this,complete), set slice::(...) or info exists pieLabeler::(...). Tcl 9 resolves such names only relative to the current namespace (e.g. ::pie::switched::), without the fallback to the global namespace of Tcl 8.
  • For a slice of 100%, slice.tcl computes the extent as 360 - pow(10, -$::tcl_precision + 3). This expects the old default tcl_precision of 12 (giving 360 - 1e-9). Since Tcl 8.5 the default is 0, which gives an extent of -640, so with Tcl 8.6 a full slice is drawn as an arc of -280 degrees. Tcl 9 does not set tcl_precision at all, so it fails there.

Making the names absolute ($::switched::(...), 91 places in 10 files) and using 360 - 1e-9 fixes both: pies work with Tk 8.6 and 9.1, and a full slice is drawn as a full circle.

User Comments: serhiy.storchaka added on 2026-11-21 13:16:33:

Proposed fix in branch tkpiechart-tcl9: the names are made absolute and a full slice gets the extent 360 - 1e-9; tkpiechart is bumped to 6.6.2.