in reply to Need help doing simple tasks in WxPerl / Wxglade

My question is, from the below code, how do I run a subroutine outside of WxPerl with the variables pushed from the GUI into the script?

What does that even mean?

1.) How to print "Hello World" (from the button eventhandler); it doesn't actually print to console until I hit the X button and close the GUI.

You're Suffering from Buffering?, STDOUT->autoflush(1); ... print "...\n\n\n\n\n\n\n";

2.) I need to be able to print the value of the radio button or checkbox and run a subroutine based on if it's set to 0 or 1 after I click the button from above. 3.) Capture the input value from the user and pass to console as variables win32 equiv:

Try  warn "@_\n"; from your event handler

Then you can use

$self->{checkbox_1}->GetValue $self->{combo_box_1}->GetValue $self->{radio_btn_1}->GetValue

You've got typos ... modern practice

my $app = Wx::SimpleApp->new; my $frame_1 = MyFrame1->new(); $app->SetTopWindow($frame_1); $frame_1->Show(1); $app->MainLoop();

my wxWidgets / wxPerl / wxGlade tutorial

Replies are listed 'Best First'.
Re^2: Need help doing simple tasks in WxPerl / Wxglade
by netnem (Initiate) on Jun 06, 2014 at 14:02 UTC

    Thanks for this response. I guess I was assuming that WxPerl was intercepting my Perl commands and not running them, and in my head I was segregating the GUI from the program, and not understanding why the program wasn't running until the GUI closed. It actually looks like it might be a buffering issue with auto flush. I've tried to printf in the event handler, but it seemed to do the same

    I think this post will be enough to get over the initial hump. Thank you so much!

    Update: Yes!!!!!! The above post has just opened up so much for me in regards to working with Wx.

    Adding the following line gives output immediately to console log and finally "makes sense" to me with what Wx is actually doing.

    select((select(STDOUT), $|=1)[0]);

    Thank you so much. I should be able to port my program from Win32 to Wx now.