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

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.

Replies are listed 'Best First'.
Re^5: wxPerl monitor size in pixels
by Anonymous Monk on May 29, 2011 at 22:43 UTC
    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__