Tk Library Source Code

View Ticket
Login
2026-11-15
23:57 • New ticket [1c877f89a4] controlwidget: voltmeter, meter and thermometer fail with Tk 9 when the size is a screen distance. artifact: 33e9bcb98c user: serhiy.storchaka
23:54
Fix [1c877f89a4]: controlwidget: voltmeter failed with Tk 9 with its default size ("50m"), meter with its default size ("2i"), and thermometer with a size given as a screen distance. Tk 9 returns the canvas -width and -height as given rather than in pixels; convert them with winfo pixels. Add controlwidget.test. leaf check-in: 4efab58a98 user: serhiy.storchaka tags: controlwidget-tk9-screen-distances

Ticket UUID: 1c877f89a4987ff04f25dbf50e8fd57c92dd93a2
Title: controlwidget: voltmeter, meter and thermometer fail with Tk 9 when the size is a screen distance
Type: Bug Version: trunk
Submitter: serhiy.storchaka Created on: 2026-11-15 23:57:43
Subsystem: tklib :: controlwidget Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2026-11-15 23:57:43
Resolution: None Closed By: nobody
    Closed on:
Description:

With Tk 9, controlwidget::voltmeter .v fails with cannot use non-numeric string "50m", and controlwidget::meter .m fails with invalid bareword "2i". The thermometer fails the same way when -width or -height is given as a screen distance, e.g. -height 2i.

The widgets use cget -width and cget -height of their canvas in computations. Tk 8.6 returned them in pixels, but since Tk 9.0 they are returned as given (Tk ticket 610a73a179). The tachometer has the same problem, see [b845a924db].

Proposed fix in branch controlwidget-tk9-screen-distances.