Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #264: Your modem doesn't speak English.


comp / comp.lang.tcl / Tk 9: image -format svg -scaletowidth not working?

SubjectAuthor
* Tk 9: image -format svg -scaletowidth not working?Mark Summerfield
`* Re: Tk 9: image -format svg -scaletowidth not working?Ralf Fassel
 +- Re: Tk 9: image -format svg -scaletowidth not working?Harald Oehlmann
 `* Re: Tk 9: image -format svg -scaletowidth not working?Mark Summerfield
  +- Re: Tk 9: image -format svg -scaletowidth not working?Harald Oehlmann
  `* Re: Tk 9: image -format svg -scaletowidth not working?nemethi
   `* Re: Tk 9: image -format svg -scaletowidth not working?Mark Summerfield
    `* Re: Tk 9: image -format svg -scaletowidth not working?nemethi
     `- Re: Tk 9: image -format svg -scaletowidth not working?Mark Summerfield

1
Subject: Tk 9: image -format svg -scaletowidth not working?
From: Mark Summerfield
Newsgroups: comp.lang.tcl
Date: Mon, 8 Jul 2024 09:52 UTC
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!border-4.nntp.ord.giganews.com!local-1.nntp.ord.giganews.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 08 Jul 2024 09:52:26 +0000
From: mark@qtrac.eu (Mark Summerfield)
Subject: Tk 9: image -format svg -scaletowidth not working?
Newsgroups: comp.lang.tcl
MIME-Version: 1.0
User-Agent: Pan/0.154 (Izium; 517acf4)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Message-ID: <MpadnXqNUoFHKxb7nZ2dnZfqnPqdnZ2d@brightview.co.uk>
Date: Mon, 08 Jul 2024 09:52:26 +0000
Lines: 44
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-PinujUUL7hvwh3hNZvEJ+QWFJgpc9UbUt26p1h+FE2DAxFntAwUNUzYq4jm/Mj4VOk4IOShg89ZDtdT!SPgAnyuJDBT2A/iMnXyGteGc1hRnjUbR7U4m8nrp2LstUm6iP+1XZ76tdp1VYpKAZme0160c3BWd!JX5i6RnHEFeBDYzkG9Hn8xOcIg==
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
View all headers

I am trying to use the -format svg -scaletowidth option without success.

Given this svg file "test.svg" (copied from W3CSchools):

<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
<circle cx="50" cy="50" r="40" stroke="green" stroke-width="4"
fill="yellow" />
</svg>

This program works fine:

#!/usr/bin/env wish9
proc icon {svg {width 0}} {
set opt [expr {$width ? "-format svg -scaletowidth $width" : ""}]
image create photo -file $svg {*}$opt
} ttk::button .button -command {destroy .} -image [icon test.svg]
grid .button

But if I want to scale the image to 24 pixels (e.g., for a menu item):

#!/usr/bin/env wish9
proc icon {svg {width 0}} {
set opt [expr {$width ? "-format svg -scaletowidth $width" : ""}]
image create photo -file $svg {*}$opt
} ttk::button .button -command {destroy .} -image [icon test.svg 24]
grid .button

It fails with this error:

Error in startup script: unknown option "-scaletowidth"
while executing
"image create photo -file $svg {*}$opt"
(procedure "icon" line 3)
invoked from within
"icon test.svg 24"
invoked from within
"ttk::button .button -command {destroy .} -image [icon test.svg 24]"
(file "./svgtest2.tcl" line 8)

Can someone tell me what I'm doing wrong?

I'm using Tcl/Tk 9.0b2 on Debian Linux.

Subject: Re: Tk 9: image -format svg -scaletowidth not working?
From: Ralf Fassel
Newsgroups: comp.lang.tcl
Date: Mon, 8 Jul 2024 12:16 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralfixx@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: Re: Tk 9: image -format svg -scaletowidth not working?
Date: Mon, 08 Jul 2024 14:16:45 +0200
Lines: 32
Message-ID: <ygamsmst6xe.fsf@akutech.de>
References: <MpadnXqNUoFHKxb7nZ2dnZfqnPqdnZ2d@brightview.co.uk>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net gekT58A5wvldFdPSO3sXngaAceA9ej5NL+MnmBPpEntjYUbpk=
Cancel-Lock: sha1:AQNy2vHljn6EUCSVSyqZMO9E68g= sha1:CBhg3IDHoUF02XdTLeV552qolRM= sha256:Z0ebXqKAIHfZHTuDF5CCMP3mi4tOC6bHyYsorf8DQ2E=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
View all headers

* Mark Summerfield <mark@qtrac.eu>
| It fails with this error:
>
| Error in startup script: unknown option "-scaletowidth"
| while executing
| "image create photo -file $svg {*}$opt"
| (procedure "icon" line 3)
| invoked from within
| "icon test.svg 24"
| invoked from within
| "ttk::button .button -command {destroy .} -image [icon test.svg 24]"
| (file "./svgtest2.tcl" line 8)
>
| Can someone tell me what I'm doing wrong?
>
| I'm using Tcl/Tk 9.0b2 on Debian Linux.

The manpage says:

Image formats may support sub-options, which are specified using
additional words in the value to the -format option.

This sounds to me as if you need to specify the additional options like
-scaletowidth *with* the -format option, like so:

-format [list svg -scaletowidth 24]

instead of

-format svg -scaletowidth 24

R'

Subject: Re: Tk 9: image -format svg -scaletowidth not working?
From: Harald Oehlmann
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Mon, 8 Jul 2024 12:27 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: wortkarg3@yahoo.com (Harald Oehlmann)
Newsgroups: comp.lang.tcl
Subject: Re: Tk 9: image -format svg -scaletowidth not working?
Date: Mon, 8 Jul 2024 14:27:54 +0200
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <v6gm04$s6vf$1@dont-email.me>
References: <MpadnXqNUoFHKxb7nZ2dnZfqnPqdnZ2d@brightview.co.uk>
<ygamsmst6xe.fsf@akutech.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 08 Jul 2024 14:27:48 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="22e93f4c71d373fba0eeca9a10bbebaf";
logging-data="924655"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19yEbu7L3z23NzULYq8xYpE"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:zCfApY7GsSZ9JxNqfwGJadn7r30=
Content-Language: en-GB
In-Reply-To: <ygamsmst6xe.fsf@akutech.de>
View all headers

Am 08.07.2024 um 14:16 schrieb Ralf Fassel:
> * Mark Summerfield <mark@qtrac.eu>
> | It fails with this error:
>>
> | Error in startup script: unknown option "-scaletowidth"
> | while executing
> | "image create photo -file $svg {*}$opt"
> | (procedure "icon" line 3)
> | invoked from within
> | "icon test.svg 24"
> | invoked from within
> | "ttk::button .button -command {destroy .} -image [icon test.svg 24]"
> | (file "./svgtest2.tcl" line 8)
>>
> | Can someone tell me what I'm doing wrong?
>>
> | I'm using Tcl/Tk 9.0b2 on Debian Linux.
>
> The manpage says:
>
> Image formats may support sub-options, which are specified using
> additional words in the value to the -format option.
>
> This sounds to me as if you need to specify the additional options like
> -scaletowidth *with* the -format option, like so:
>
> -format [list svg -scaletowidth 24]
>
> instead of
>
> -format svg -scaletowidth 24
>
> R'

Mark,
sorry for the odd format. It is always bad, if internals expose on user
level. This is an internal issue. There is only the "-format" string
which is communicated to the image format driver. Instead of adding
something like "driver options", this format string was extended to a list.
I would love to change this one day...

Thank you for your understanding,
Harald

Subject: Re: Tk 9: image -format svg -scaletowidth not working?
From: Mark Summerfield
Newsgroups: comp.lang.tcl
Date: Tue, 9 Jul 2024 07:26 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 09 Jul 2024 07:26:58 +0000
From: mark@qtrac.eu (Mark Summerfield)
Subject: Re: Tk 9: image -format svg -scaletowidth not working?
Newsgroups: comp.lang.tcl
References: <MpadnXqNUoFHKxb7nZ2dnZfqnPqdnZ2d@brightview.co.uk>
<ygamsmst6xe.fsf@akutech.de>
MIME-Version: 1.0
User-Agent: Pan/0.154 (Izium; 517acf4)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Message-ID: <16ucnaYr1PPfexH7nZ2dnZfqnPSdnZ2d@brightview.co.uk>
Date: Tue, 09 Jul 2024 07:26:58 +0000
Lines: 40
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-YwVdRSCSF4mGbMnRAG03DFuKps7qbng7uTysfexoC9J9vuTaYMQkgxlxCrwN6+JhAVkn64L6FFmMdbG!PYTXMmTX9NR5l0DVzAgM6iUJ9Nn7+PhOCKixW2BDGIHYllRkh1AOj00zFm/9eHJecVo47dK1+NB1!tTgM6TXiXXuBbQDR/w8kD3pyLQ==
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
View all headers

On Mon, 08 Jul 2024 14:16:45 +0200, Ralf Fassel wrote:

> * Mark Summerfield <mark@qtrac.eu>
[snip]
> | Can someone tell me what I'm doing wrong?
>>
> | I'm using Tcl/Tk 9.0b2 on Debian Linux.
>
> The manpage says:
>
> Image formats may support sub-options, which are specified using
> additional words in the value to the -format option.
>
> This sounds to me as if you need to specify the additional options like
> -scaletowidth *with* the -format option, like so:
>
> -format [list svg -scaletowidth 24]
>
> instead of
>
> -format svg -scaletowidth 24

Thank you, I'm now using:

proc util::icon {svg {width 0}} {
set opt [expr {$width ? [list -format [list svg -scaletowidth $width]]
\ : ""}]
image create photo -file $::PATH/images/$svg {*}$opt
}

And when I call this for menu items I use:

set width [expr {int(16 * [tk scaling])}]
....
-image [util::icon new.svg $width]

The 'int' is *essential* since -scaletowidth won't accept a real.

I think adding support for SVG images is a real plus for Tk.

Subject: Re: Tk 9: image -format svg -scaletowidth not working?
From: Harald Oehlmann
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Tue, 9 Jul 2024 08:13 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: wortkarg3@yahoo.com (Harald Oehlmann)
Newsgroups: comp.lang.tcl
Subject: Re: Tk 9: image -format svg -scaletowidth not working?
Date: Tue, 9 Jul 2024 10:13:19 +0200
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <v6irev$19pva$1@dont-email.me>
References: <MpadnXqNUoFHKxb7nZ2dnZfqnPqdnZ2d@brightview.co.uk>
<ygamsmst6xe.fsf@akutech.de>
<16ucnaYr1PPfexH7nZ2dnZfqnPSdnZ2d@brightview.co.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 09 Jul 2024 10:13:19 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="9654c8edbcf0fc704dc2fa1e0b6c21d9";
logging-data="1370090"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+FRNp6zdQjt5d441IFnrAb"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:28BveBxfKGNyo4k/LXuKGU46Eos=
In-Reply-To: <16ucnaYr1PPfexH7nZ2dnZfqnPSdnZ2d@brightview.co.uk>
Content-Language: en-GB
View all headers

Am 09.07.2024 um 09:26 schrieb Mark Summerfield:
> I think adding support for SVG images is a real plus for Tk.

Yes, it is essential. All internal images in Tk 9 are now svg and are
scaleable.

The exact same svg image code is available for Tk 8.6 as an extension here:

https://github.com/oehhar/tksvg

The prebuild dlls are helful for many use-cases...

And thanks to Mikko Mononen (nanosvg), Christian Gollwitzer (tksvg) and
Csaba Nemeti (scalable Tk) !

Take care,
Harald

Subject: Re: Tk 9: image -format svg -scaletowidth not working?
From: nemethi
Newsgroups: comp.lang.tcl
Date: Tue, 9 Jul 2024 09:15 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.tota-refugium.de!.POSTED!not-for-mail
From: csaba.nemethi@t-online.de (nemethi)
Newsgroups: comp.lang.tcl
Subject: Re: Tk 9: image -format svg -scaletowidth not working?
Date: Tue, 9 Jul 2024 11:15:38 +0200
Message-ID: <v6iv3q$d2tg$1@tota-refugium.de>
References: <MpadnXqNUoFHKxb7nZ2dnZfqnPqdnZ2d@brightview.co.uk>
<ygamsmst6xe.fsf@akutech.de>
<16ucnaYr1PPfexH7nZ2dnZfqnPSdnZ2d@brightview.co.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 9 Jul 2024 09:15:38 -0000 (UTC)
Injection-Info: tota-refugium.de;
logging-data="428976"; mail-complaints-to="abuse@news.tota-refugium.de"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:QAP/hB3zJxlitDZpn26Dd4rKhaE=
X-User-ID: eJwFwYEBwCAIA7CXUCjYc4TV/09YAs+VU5HIwMPTHsi6g03xpJz1geVqlx5XHbsWnNpC3fUDJfQRHw==
Content-Language: en-US
In-Reply-To: <16ucnaYr1PPfexH7nZ2dnZfqnPSdnZ2d@brightview.co.uk>
View all headers

Am 09.07.24 um 09:26 schrieb Mark Summerfield:
> On Mon, 08 Jul 2024 14:16:45 +0200, Ralf Fassel wrote:
>
>> * Mark Summerfield <mark@qtrac.eu>
> [snip]
>> | Can someone tell me what I'm doing wrong?
>>>
>> | I'm using Tcl/Tk 9.0b2 on Debian Linux.
>>
>> The manpage says:
>>
>> Image formats may support sub-options, which are specified using
>> additional words in the value to the -format option.
>>
>> This sounds to me as if you need to specify the additional options like
>> -scaletowidth *with* the -format option, like so:
>>
>> -format [list svg -scaletowidth 24]
>>
>> instead of
>>
>> -format svg -scaletowidth 24
>
> Thank you, I'm now using:
>
> proc util::icon {svg {width 0}} {
> set opt [expr {$width ? [list -format [list svg -scaletowidth $width]]
> \
> : ""}]
> image create photo -file $::PATH/images/$svg {*}$opt
> }
>
> And when I call this for menu items I use:
>
> set width [expr {int(16 * [tk scaling])}]
> ...
> -image [util::icon new.svg $width]
>
> The 'int' is *essential* since -scaletowidth won't accept a real.
>
> I think adding support for SVG images is a real plus for Tk.

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.

--
Csaba Nemethi https://www.nemethi.de mailto:csaba.nemethi@t-online.de

Subject: Re: Tk 9: image -format svg -scaletowidth not working?
From: Mark Summerfield
Newsgroups: comp.lang.tcl
Date: Tue, 9 Jul 2024 09:55 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!border-3.nntp.ord.giganews.com!nntp.giganews.com!local-2.nntp.ord.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 09 Jul 2024 09:55:46 +0000
From: mark@qtrac.eu (Mark Summerfield)
Subject: Re: Tk 9: image -format svg -scaletowidth not working?
Newsgroups: comp.lang.tcl
References: <MpadnXqNUoFHKxb7nZ2dnZfqnPqdnZ2d@brightview.co.uk>
<ygamsmst6xe.fsf@akutech.de>
<16ucnaYr1PPfexH7nZ2dnZfqnPSdnZ2d@brightview.co.uk>
<v6iv3q$d2tg$1@tota-refugium.de>
MIME-Version: 1.0
User-Agent: Pan/0.154 (Izium; 517acf4)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Message-ID: <6Gydne-C-ru_lBD7nZ2dnZfqnPQAAAAA@brightview.co.uk>
Date: Tue, 09 Jul 2024 09:55:46 +0000
Lines: 32
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-MAnGnHIwF9N1TK39iRrdW9sEyUrktaU+twt7nMymDROH4xPRPyahtoJG4Jhz+cJeHUshlwlLta3TuX7!yF8VyeXtQoRdtsCsMyeNPNqBFPwD83RceGZOLuKm05KNOBBXmiHxu3FGVC3XgKXkFk2YHKsscE7M!xcjqeLnxOZAQGKDTzROyudNh/w==
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
View all headers

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).

Subject: Re: Tk 9: image -format svg -scaletowidth not working?
From: nemethi
Newsgroups: comp.lang.tcl
Date: Tue, 9 Jul 2024 11:03 UTC
References: 1 2 3 4 5
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.tota-refugium.de!.POSTED!not-for-mail
From: csaba.nemethi@t-online.de (nemethi)
Newsgroups: comp.lang.tcl
Subject: Re: Tk 9: image -format svg -scaletowidth not working?
Date: Tue, 9 Jul 2024 13:03:55 +0200
Message-ID: <v6j5er$d6f0$1@tota-refugium.de>
References: <MpadnXqNUoFHKxb7nZ2dnZfqnPqdnZ2d@brightview.co.uk>
<ygamsmst6xe.fsf@akutech.de>
<16ucnaYr1PPfexH7nZ2dnZfqnPSdnZ2d@brightview.co.uk>
<v6iv3q$d2tg$1@tota-refugium.de>
<6Gydne-C-ru_lBD7nZ2dnZfqnPQAAAAA@brightview.co.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 9 Jul 2024 11:03:55 -0000 (UTC)
Injection-Info: tota-refugium.de;
logging-data="432608"; mail-complaints-to="abuse@news.tota-refugium.de"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:quMb+EZRJSaOtmEihk4Rsd+3zh0=
In-Reply-To: <6Gydne-C-ru_lBD7nZ2dnZfqnPQAAAAA@brightview.co.uk>
Content-Language: en-US
X-User-ID: eJwFwYEBACAEBMCVCC/j1Mv+I3QXBgXTEfCYmC7QxMdvztNzpB80W8kd4B7jrZJVOr5o0R8qMRFk
View all headers

Am 09.07.24 um 11:55 schrieb Mark Summerfield:
> 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).

In Tk 9 it makes a difference whether you write $tk::svgFmt or
$::tk::svgFmt -- the former will only work at global level.

--
Csaba Nemethi https://www.nemethi.de mailto:csaba.nemethi@t-online.de

Subject: Re: Tk 9: image -format svg -scaletowidth not working?
From: Mark Summerfield
Newsgroups: comp.lang.tcl
Date: Wed, 10 Jul 2024 07:21 UTC
References: 1 2 3 4 5 6
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!border-4.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 10 Jul 2024 07:21:34 +0000
From: mark@qtrac.eu (Mark Summerfield)
Subject: Re: Tk 9: image -format svg -scaletowidth not working?
Newsgroups: comp.lang.tcl
References: <MpadnXqNUoFHKxb7nZ2dnZfqnPqdnZ2d@brightview.co.uk>
<ygamsmst6xe.fsf@akutech.de>
<16ucnaYr1PPfexH7nZ2dnZfqnPSdnZ2d@brightview.co.uk>
<v6iv3q$d2tg$1@tota-refugium.de>
<6Gydne-C-ru_lBD7nZ2dnZfqnPQAAAAA@brightview.co.uk>
<v6j5er$d6f0$1@tota-refugium.de>
MIME-Version: 1.0
User-Agent: Pan/0.154 (Izium; 517acf4)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Message-ID: <Q82dneR7AuPjqxP7nZ2dnZfqnPSdnZ2d@brightview.co.uk>
Date: Wed, 10 Jul 2024 07:21:34 +0000
Lines: 7
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-xmr2vqPaiFvjSpTLomxNwuhbKP8mitmUa0ZZag8z6ixcHIx5mCNK21r6l0LLigPhHUgvl5NHVuZR2dj!NrJRYoV/SP3jMaUf6/9qsMalImpIveOrwih2Dl34zBbftwj/yOEf8pniLP0Ibm5mnvicxo7U6rxW!ldfC0gu7LheVZ8oLvGyYblm7Fg==
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
View all headers

On Tue, 9 Jul 2024 13:03:55 +0200, nemethi wrote:
[snip]

> In Tk 9 it makes a difference whether you write $tk::svgFmt or
> $::tk::svgFmt -- the former will only work at global level.

Yes of course, sorry, still getting used to that.

1

rocksolid light 0.9.8
clearnet tor