Re: Tk 9: image -format svg -scaletowidth not working?

Liste des GroupesRevenir à cl tcl 
Sujet : Re: Tk 9: image -format svg -scaletowidth not working?
De : mark (at) *nospam* qtrac.eu (Mark Summerfield)
Groupes : comp.lang.tcl
Date : 09. Jul 2024, 10:55:46
Autres entêtes
Message-ID : <6Gydne-C-ru_lBD7nZ2dnZfqnPQAAAAA@brightview.co.uk>
References : 1 2 3 4
User-Agent : Pan/0.154 (Izium; 517acf4)
On Tue, 9 Jul 2024 11:15:38 +0200, nemethi wrote:

[snip]
The way you are using [tk scaling] is not quite correct.  I guess your
intention was to scale 16 x 16 px images according to the display's (or
Tk's) scaling level.  However, [tk scaling] is the number of pixels per
point, hence it is not appropriate for scaling a width given in pixels.
 
The recommended method in Tk 9 is to use the variable tk::svgFmt when
creating scaling-aware images (see man tk_svgFmt).  This variable is set
at Tk initialization time to {svg -scale 1.0}, {svg -scale 1.25}, etc.,
and is updated automatically if you increase the scaling with the aid of
the "tk scaling" command.  For example, if you invoke "tk scaling
1.666666" or "tk scaling 1.7" then tk::svgFmt will automatically become
{svg -scale 1.25}, hence its use as the value of the -format option will
result in images of the size 20 x 20 px.

when I try:

puts $tk::svgFmt

I get "Error in startup script: can't read "tk::svgFmt": no such variable"

But in any case it wouldn't give me what I want.

I have svg images that I'm using as icons that happen to have a notional
size of 48x48 px. The scale factor of 16 * [tk scaling] simply represents
the size that works for me (i.e., makes the icons a little taller than a
capital letter), say for the File menu's "New" menu item. So I'm not
really scaling to a particular pixel size, just a size that works visually
and that should work at different scales on different screens (although I
haven't yet tried that).

Date Sujet#  Auteur
8 Jul 24 * Tk 9: image -format svg -scaletowidth not working?9Mark Summerfield
8 Jul 24 `* Re: Tk 9: image -format svg -scaletowidth not working?8Ralf Fassel
8 Jul 24  +- Re: Tk 9: image -format svg -scaletowidth not working?1Harald Oehlmann
9 Jul 24  `* Re: Tk 9: image -format svg -scaletowidth not working?6Mark Summerfield
9 Jul 24   +- Re: Tk 9: image -format svg -scaletowidth not working?1Harald Oehlmann
9 Jul 24   `* Re: Tk 9: image -format svg -scaletowidth not working?4nemethi
9 Jul 24    `* Re: Tk 9: image -format svg -scaletowidth not working?3Mark Summerfield
9 Jul 24     `* Re: Tk 9: image -format svg -scaletowidth not working?2nemethi
10 Jul 24      `- Re: Tk 9: image -format svg -scaletowidth not working?1Mark Summerfield

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal