-
Notifications
You must be signed in to change notification settings - Fork 10
wxPerl: Sample Program
Randalphwa edited this page Apr 30, 2025
·
1 revision
Creating a main window and running it is easy to do. Using wxUiEditor, create a wxFrame window (in this example, the class name is created as MainFrame). Generate the file and open it in an editor. At the end of the file, you will see the following comment block:
# ************* End of generated code ***********
# DO NOT EDIT THIS COMMENT BLOCK!
#
# Code below this comment block will be preserved
# if the code for this class is re-generated.
# ***********************************************
1;After the 1; line, enter the following code and then save the file.
package main;
my $app = Wx::SimpleApp->new;
my $frame = MainFrame->new( undef, -1 );
$frame->Show;
$app->MainLoop;
1;Now all you need to do is enter the following in a command line where my_file.pl is the name of the file you created:
perl my_file.py
Note that if you need to add event handlers, you insert them between the end of the generated comment block and the 1;. That 1; is only added when the file is first generated -- after that it's up to you to maintain it to close the class implementation.