in reply to Re^2: wxPerl monitor size in pixels
in thread wxPerl monitor size in pixels

Gives the same result 1707x960, but my screen is 2560x1440 pixels!?

Can be a problem in wxWidgets.

perl -MWx -e "print join q[ ] , $Wx::VERSION, Wx::wxVERSION_STRING "

prints: 0.99 wxWidgets 2.8.12

Replies are listed 'Best First'.
Re^4: wxPerl monitor size in pixels
by Corion (Patriarch) on May 29, 2011 at 14:22 UTC

    Works for me, with the restriction that it only returns the measures for the first screen.

    > perl -MWx -le " print join q[x], Wx::ScreenDC ->new-> GetSizeWH " 1920x1200 > perl -MWx -e "print join q[ ] , $Wx::VERSION, Wx::wxVERSION_STRING " 0.98 wxWidgets 2.8.10

    Update: Still works after upgrading to Wx 0.99:

    > perl -MWx -e "print join q[ ] , $Wx::VERSION, Wx::wxVERSION_STRING " 0.99 wxWidgets 2.8.10 > perl -MWx -le " print join q[x], Wx::ScreenDC ->new-> GetSizeWH " 1920x1200
    > perl -v This is perl 5, version 12, subversion 1 (v5.12.1) built for MSWin32-x +86-multi-thread Copyright 1987-2010, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge.
      Works for me, with the restriction that it only returns the measures for the first screen.

      s/first/primary/;

      Try this for all screens

      { use Wx; my $count = Wx::Display::GetCount(); my $dc = 0; while( $dc < $count ){ my $disp = Wx::Display->new( $dc ); my $rect = $disp->GetGeometry; print "$dc $disp ", join 'x', map { $rect->$_ } qw[ GetWidth G +etHeight ]; print "\n"; print "$dc $disp ", $disp->GetName, "\n"; print "$dc $disp ", ' IsPrimary ', $disp->IsPrimary, "\n"; print "\n"; $dc++; } } __END__