Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

wxPerl behavior on Win32

by solomon243 (Novice)
on Oct 27, 2014 at 16:54 UTC ( [id://1105181]=perlquestion: print w/replies, xml ) Need Help??

solomon243 has asked for the wisdom of the Perl Monks concerning the following question:

When running on linux, my wxPerl application looks well. But running this script on Windows XP shocks me:


http://www.mazoot.org/ScreenFridayCalc.PNG


how to set an background color for entire frame? here is my "code" :)
#!/usr/bin/perl use utf8; use Wx qw( :frame :textctrl :sizer :panel :window :id ); use Wx::Event qw(EVT_CLOSE EVT_BUTTON); $VERSION = '0.001'; @drink_list = ('пиво','вод&# +1082;а','коньяк','л&# +1080;монад'); $| = 1; my $app = Wx::SimpleApp->new; my $frame = Wx::Frame->new( undef, -1, "Пятни&#1095 +;ный кальку&#10 +83;ятор v$VERSION", [-1, -1], [-1,-1], wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION + |wxCLOSE_BOX | wxCLIP_CHILDREN #| wxBORDER_NONE ); my $panel = Wx::Panel->new( $frame, # parent window 1, # ID [5,5], [100,100] ); my $panel2 = Wx::Panel->new( $frame, # parent window 1, # ID [-1,-1], [100,100] ); my $bigbutton = Wx::Button->new( $frame, 1, 'Вып&#10 +86;лнить расч&# +1077;т', [-1,-1], [-1,-1]); my $mass_label = Wx::StaticText->new($panel, 2, 'Ваш + вес:',[-1,-1], [-1,-1]); my $drink_label = Wx::StaticText->new($panel2, 4, 'Пр&#107 +7;дпочитаем&#10 +99;й напиток:',[-1,-1 +], [-1,-1]); my $mass_entry = Wx::TextCtrl->new($panel, 3, '',[-1,-1], [-1,-1]); my $grszr =Wx::GridSizer->new(2,2,20,20); my $boxsizer = Wx::BoxSizer->new(wxVERTICAL); my $boxsizer2 = Wx::BoxSizer->new(wxVERTICAL); my $drink_choice = Wx::Choice->new($panel2, 4,[-1,-1],[-1,-1],\@drink_ +list); $boxsizer->Add($mass_label); $boxsizer->Add($mass_entry); $boxsizer2->Add($drink_label); $boxsizer2->Add($drink_choice); $grszr->Add($panel, 0, wxALIGN_CENTRE|wxTOP|wxBOTTOM|wxLEFT|wxRIGHT, 1 +0); $grszr->Add($panel2, 0, wxALIGN_CENTRE|wxTOP|wxBOTTOM|wxLEFT|wxRIGHT, +10); $grszr->Add($bigbutton, 0, wxALIGN_CENTRE|wxTOP|wxBOTTOM|wxLEFT|wxRIGH +T, 10); sub helloe { my $val = $mass_entry->GetValue(); $val = $val * 2; print "doubled Mass of user is $val\n"; Wx::MessageBox("Вам можн +о выпить $val р&#1102 +;мок",'Резуль&# +1090;ат:', wxOK, undef); } EVT_BUTTON( $frame, $bigbutton, \&helloe ); $panel->SetAutoLayout(1); $panel->SetSizer($boxsizer); $panel2->SetAutoLayout(1); $panel2->SetSizer($boxsizer2); $frame->SetSizer($grszr); $frame->SetAutoLayout(1); #### $frame->SetBackgroundColor(0); $frame->Show; $app->MainLoop;


on Linux: perl (v5.14.2) built for i486-linux-gnu-thread-multi-64int

on Windows: perl (v5.16.3) built for MSWin32-x86-multhread (Citrus Perl distribution 'citrusperl-standard-51603-msw-x86-018')

Replies are listed 'Best First'.
Re: wxPerl behavior on Win32
by jmlynesjr (Deacon) on Oct 27, 2014 at 20:32 UTC

    Have you tried   $frame->SetBackgroundColour(wxRED);?

    From the wxBook, "Because wxFrame derives from wxTopLevelWindow and wxWindow, please also refer to the member functions for these classes".

    Stock color objects are wxBLACK, wxWHITE, wxRED, wxBLUE, wxGREEN, wxCYAN, and wxLIGHT_GREY. There are also many available standard colors, too many to type here, accessed by:   Wx::Colour->new("yellow"); or Wx::Colour->newRGB(#,#,#);

    James

    There's never enough time to do it right, but always enough time to do it over...

      this work well:


      $frame->SetBackgroundColour(Wx::SystemSettings::GetSystemColour(wxSYS_ +COLOUR_WINDOW));



      now there are no dark areas around widgets. almost.

        Great! Glad you found a fix.

        James

        There's never enough time to do it right, but always enough time to do it over...

Re: wxPerl behavior on Win32
by Anonymous Monk on Oct 27, 2014 at 21:38 UTC

    When running on linux, my wxPerl application looks well. But running this script on Windows XP shocks me:

    Why? Please explain

    #!/usr/bin/perl -- use strict; use warnings; use Wx; my $app = Wx::SimpleApp->new; my $frame = Wx::Frame->new( undef, -1, "", ); $frame->SetBackgroundColour( Wx::wxBLACK() ); $frame->SetSizer( Wx::BoxSizer->new( Wx::wxVERTICAL() ) ); for(1..10){ my $t = Wx::StaticText->new( $frame , -1, "yo ".rand, ) ; $t->SetBackgroundColour( Wx::wxRED() ); my $b = Wx::Button->new( $frame , -1, rand." yo", ); $frame->GetSizer->Add( $t, 0, 0 ); $frame->GetSizer->Add( $b, 0, Wx::wxEXPAND() ); } $frame->Show(1); $app->SetTopWindow( $frame ); $app->MainLoop;
      >>> Why? Please explain

      it wasn't pleasant to me that near widgets a background light, and primary color of a frame - dark

      and so was only under windows

        it wasn't pleasant to me that near widgets a background light, and primary color of a frame - dark

        and so was only under windows

        FWIW, I usually solve that problem by making your "$frame" a wxPanel

        The background ends up being the usual panel light grey of wxSYS_COLOUR_MENU /
        #D4D0C8
        instead of the darker frame/MDI "grey" of wxSYS_COLOUR_APPWORKSPACE
        #D4D0C8

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1105181]
Approved by jellisii2
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-19 12:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found