Torsten a écrit le 11/10/2015 19:35 :
> The text widget docu says that '"0" is used in translating from character units to screen units.'. There is a mismatch with the results from "font measure".
>
> package require Tk
> set w0 [font measure TkMenuFont "0"]
> set w1 [font measure TkMenuFont [string repeat "0" 60]]
> text .t1 -height 20 -width 60 -font TkMenuFont
> pack .t1
> update
> set w2 [winfo width .t1]
> puts "w0= $w0, w1= $w1, w2= $w2"
>
> Windows:
> w0= 6, w1= 360, w2= 364
> 6*60= 360 OK, but 364?
You get what you expect (w2 = 360) if you configure the text widget
with -padx 0 -borderwidth 0.
These two options have default value 1 and that is counted (twice for
each) in the total width returned by winfo width .t1
> Mac OS:
> w0= 9, w1= 532, w2= 548
> 9*60= 540 is neither 532 nor 548. The difference of 16px is almost the width of two characters!
Cannot check/investigate 'cause no Mac OS reachable for me, sorry.
Regards,
Francois