• Scale WIndows Display

    From The Rickster@21:1/5 to All on Tue Dec 27 12:10:04 2022
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to The Rickster on Tue Dec 27 23:19:54 2022
    The Rickster <sled99dog@gmail.com> wrote:
    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).

    Where in the docs do you see that "tk scaling" would change the windows
    system scaling setting? The docs say "Sets and queries the current
    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 do
    so.

    If there is none in twapi, you might have no way to do so from inside a
    Tcl script.

    Would appreciate any insight as to how one might change the Windows
    scaling percentage value.

    Use the Windows Control Panel.

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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Rickster@21:1/5 to Rich on Wed Dec 28 19:29:00 2022
    On Tuesday, December 27, 2022 at 3:19:58 PM UTC-8, Rich wrote:
    The Rickster <sled...@gmail.com> wrote:
    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).
    Where in the docs do you see that "tk scaling" would change the windows system scaling setting? The docs say "Sets and queries the current
    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 do
    so.
    If there is none in twapi, you might have no way to do so from inside a
    Tcl script.
    Would appreciate any insight as to how one might change the Windows
    scaling percentage value.
    Use the Windows Control Panel.

    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".
    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.
    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?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ashok@21:1/5 to The Rickster on Thu Dec 29 17:27:04 2022
    On 12/29/2022 8:59 AM, The Rickster wrote:
    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?

    twapi does not directly offer this and afaik there is no documented
    interface.

    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mole Cool@21:1/5 to All on Thu Dec 29 05:09:49 2022
    On the same PC I run an old 8.4 App, here 'tk scaling' returns 1.3333 and the whole fonts looks blurry, I change the tk scaling to 1.5, and it looks better, but not perfect. If I move to a HD Display, it looks much better, so it is tricky.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mole Cool@21:1/5 to All on Thu Dec 29 05:03:19 2022
    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.

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

    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)

    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Rickster@21:1/5 to moleco...@googlemail.com on Thu Dec 29 20:26:10 2022
    On Thursday, December 29, 2022 at 5:03:21 AM UTC-8, moleco...@googlemail.com wrote:
    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.

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

    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)

    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.
    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
    those applications. Hence, they desire to manage some of the underlying os settings. To that end, our applications enable them to perform and evaluate usability and effectiveness of the applications they simulate with our code. To wit, an airline
    licensed the software to develop and test simulicrums of airport kiosk self ticketing interactions.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Rickster@21:1/5 to Ashok on Thu Dec 29 22:56:10 2022
    On Thursday, December 29, 2022 at 3:57:07 AM UTC-8, Ashok wrote:
    On 12/29/2022 8:59 AM, The Rickster wrote:
    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?
    twapi does not directly offer this and afaik there is no documented interface.

    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
    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
    value of variables as they are modified, or to be notified audibly when a proc is entered or exited. Be glad to give a snippet of the tcom code to anyone interested.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)