Need: programmatically change Windows scaling percentage.
Background:
Windows Display Settings provides for one to manually change the display scaling.
The value of the current pixels per point is accessible with the tcl
command 'tk scaling'. However, using this command does not change
the windows scaling factor (as described in the docs).
I was unable to locate a command in the twapi package that would do
so.
Would appreciate any insight as to how one might change the Windows
scaling percentage value.
The Rickster <sled...@gmail.com> wrote:Suggest you read and reinterpret what I wrote; which expressed a clear understanding of the functionality of tk scaling. Thanks for the response. However I was asking for a solution; not an opinion - which contains spelling errors that perturb me.
Need: programmatically change Windows scaling percentage.
Background:
Windows Display Settings provides for one to manually change the display scaling.
The value of the current pixels per point is accessible with the tcl command 'tk scaling'. However, using this command does not changeWhere in the docs do you see that "tk scaling" would change the windows system scaling setting? The docs say "Sets and queries the current
the windows scaling factor (as described in the docs).
scaling factor used by Tk to convert between physical units (for
example, points, inches, or millimeters) and pixels."
The very important part of that sentence is "used by Tk" -- note this
is not saying "used by ms-windows".
I was unable to locate a command in the twapi package that would doIf there is none in twapi, you might have no way to do so from inside a
so.
Tcl script.
Would appreciate any insight as to how one might change the WindowsUse the Windows Control Panel.
scaling percentage value.
If you meant to add "... from a Tcl script" then there may be no way to
do so.
And, myself, I'd be most pertubed at a windows program that decided it
was going to change the system scale factor unilaterally. That value
impacts all running programs on the system, not just a single app that
wants to mess around with it. My preference would be: "programs do not
change that value, ever".
So, do you know whether or not twapi offers the needed functionality?
Do you know of a Windows com object\interface that provides for the needed functionality?
I had similar issues with one application. But if you would be able to change the Windows Scaling, and the event is fired to all running apps, what is the benefit for you.Solution, if you have a font height of 12 and your scale 150%, MS would use 16 instead. Next don't forget you may have multiple screens, with different scale values as well.
I ended up, with a couple of calculations at the beginning. Next I scaled my used fonts, but you have still an issues if you interface will have label/button images. You need to have them in a couple of dimensions. As far I understand the Microsoft
The winfo command, with dpi calculation is a little bit misleading. As far I see, on my computer for example 'winfo pixels . 1i' will return 144. But my screen has ~190 Dots per Inch (2.520 x 1.680 with 16 inch diagonal, tk scale returns here 1.99775,and MS set the factor to 150%)
The registry value HKCU/Control Panel/Desktop/WindowMetrics/AppliedDPI is set to 144 (same as winfo pixels . 1i returns)First, thanks for the response. The why or benefit is this: our product enables licensee developers to build visual simulicrums of their (not our) desktop applications. It provides for the management of their users haptic and verbal interaction with
Yes, you ask for a solution, but it's not that simple :-(
I reviewed also 'Windows scaling issues for high-DPI devices' at support MS, you may check the DPI Awareness section.
On 12/29/2022 8:59 AM, The Rickster wrote:Hello and thank you so much. The user may now, with the use of our speech rec component, verbally change the dpi setting of their system. As an side, we use SAPI text-to-speech in order to debug tcl scripts. It is sometimes more efficient to hear the
So, do you know whether or not twapi offers the needed functionality?twapi does not directly offer this and afaik there is no documented interface.
Do you know of a Windows com object\interface that provides for the needed functionality?
However, take a look at
https://github.com/lihas/windows-DPI-scaling-sample, in particular the
one using SystemParametersInfo. You may be able to adapt that using
either twapi::SystemParametersInfo or the CFFI package (https://cffi.magicsplat.com).
I don't have time to try it myself so no guarantees and use at your own
risk :-)
/Ashok
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 493 |
Nodes: | 16 (2 / 14) |
Uptime: | 14:24:17 |
Calls: | 9,711 |
Calls today: | 1 |
Files: | 13,740 |
Messages: | 6,181,698 |