G'day Discipulus,

I don't believe I've ever used either of those mm methods; and I don't think I've used mm sizes for specifying widths, padding, etc. Except for character sizes for a few text-based widgets, I always gone with pixels. Anyway, I was curious and do seem to have a similar issue to what you describe. Here's the output from the test code you posted:

screen name :0.0 pixel width 2560 pixel height 1440 scaling 1.33398982438864 mm width 677 mm height 381

I have Perl 5.32 and Tk 804.035 running on a Cygwin/Win10 OS. The system (Win10 Settings) reports 2560x1440; I'm pretty sure that's accurate. The manufacturer's spec gives the monitor width as 27" — I wonder if that's the physical size (i.e. includes the housing surrounding the useable/viewable part of the screen).

Those numbers would give me a DPI of 94.8148148148148 (2560/27); and, factoring in the scaling, a point size of 1/71.0761154855644" (not the expected 1/72").

I don't know how the mm sizes are determined. I had a look in https://github.com/eserte/perl-tk/blob/master/Tk/Widget.pm but couldn't see anything useful there; it's probably hidden away in XS code somewhere.

I also had a look in "Active bugs for Tk". I didn't see anything relevant but, with 140 outstanding issues, it's not impossible that I missed something. It may be worth raising a bug report.

I don't use PowerShell but I do have it available. I tried your Get-WmiObject command, both as a normal user and as Administrator, and got the same error:

PS C:\WINDOWS\system32> Get-WmiObject -Namespace root\WMI -ComputerNa +me localhost -Query "select InstanceName, MaxHorizontalImagesize, Max +vwerticalImageSize from WmiMoninitorBasicDisplayParams" Get-WmiObject : Invalid class "WmiMoninitorBasicDisplayParams" At line:1 char:1 + Get-WmiObject -Namespace root\WMI -ComputerName localhost -Query "s +e ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~ + CategoryInfo : InvalidType: (:) [Get-WmiObject], Manage +mentException + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.Powe +rShell.Commands.GetWmiObjectCommand

I, too, was a little surprised at the scaling value. The system (Win10 Settings) reports scaling of 100%; not 133.398982438864%.

— Ken


In reply to Re: Tk screen and monitor size in mm, DPI and scaling by kcott
in thread Tk screen and monitor size in mm, DPI and scaling by Discipulus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.