|
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:40 | • Ticket [b845a924db] Tachometer : a wrong angle is calculated in method drawline status still Open with 3 other changes artifact: 01651849a4 user: serhiy.storchaka | |
| 23:32 | Fix [b845a924db]: the tachometer needle angle was computed with integer division when -min, -max and the value are integers. Also, with Tk 9 the tachometer failed with its default size, because canvas cget -width returns the screen distance as given ("50m"); convert it to pixels. Add controlwidget.test. leaf check-in: 415c80d49d user: serhiy.storchaka tags: tachometer-needle-angle | |
|
2020-09-20
| ||
| 11:05 | • New ticket [b845a924db] Tachometer : a wrong angle is calculated in method drawline. artifact: b93d1783d4 user: anonymous | |
| Ticket UUID: | b845a924db12c9f62ee15a483f068644679020f9 | |||
| Title: | Tachometer : a wrong angle is calculated in method drawline | |||
| Type: | Bug | Version: | Tklib 0.7 | |
| Submitter: | anonymous | Created on: | 2020-09-20 11:05:56 | |
| Subsystem: | tklib :: controlwidget | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Open | Last Modified: | 2026-11-15 23:40:01 | |
| Resolution: | None | Closed By: | nobody | |
| Closed on: | ||||
| Description: |
in tachometer.tcl
a wrong angle is calculated when both -min and -max are set to an integer value, and the value is integer
In the example included in the source file, this fails:
set ::value2 1
controlwidget::tachometer .t2 -variable ::value2 -min 0 -max 10
This works
set ::value2 1
controlwidget::tachometer .t2 -variable ::value2 -min 0.0 -max 10
controlwidget::tachometer .t2 -variable ::value2 -min 0 -max 10.0
controlwidget::tachometer .t2 -variable ::value2
In method drawline, When min, max and v are integers, the calculation of the angle is done using integer division, and the result truncated.
the line
set v [expr { ($value <= ($max*1.02))? $value : ($max*1.02) }]
could be changed to
set v [expr { ($value <= ($max*1.02))? $value*1.0 : ($max*1.02) }]
to enforce floating point division
| |||
| User Comments: |
serhiy.storchaka added on 2026-11-15 23:40:01:
Proposed fix in branch tachometer-needle-angle. The angle is now computed in floating point. The branch also fixes another problem: with Tk 9 the tachometer failed with its default size, because cget -width of the canvas returns "50m" instead of pixels. | |||
