Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Easier GUI

by kcott (Archbishop)
on Oct 16, 2010 at 19:53 UTC ( [id://865720]=note: print w/replies, xml ) Need Help??


in reply to Easier GUI

I don't use GUI creators/generators for Perl/Tk. My reasons are much the same as zentara has posted above.

I often see monolithic code that builds the entire GUI. Apart from being a poor programming technique to start with; it becomes a maintenance nightmare with anything beyond the simplest GUI. I aim for a modular approach. Here's a very rough example:

use Tk; { my $mw = Tk::MainWindow->new(); configure_main_window($mw); build_menubar($mw); build_toolbar($mw); build_main_content($mw); build_statusbar($mw); } MainLoop; sub build_main_content { my ($mw) = @_; my $main_content_frame = $mw->Frame(); build_input_widgets($main_content_frame); build_output_widgets($main_content_frame); build_action_widgets($main_content_frame); }

Once you have a basic skeleton, you can use this as a template for all your GUIs. Now you're starting to create your own automated tool.

You'll find that using this method will give all your GUIs the same look and feel. It also saves a lot of time because you don't need to write every new GUI from scratch.

If you're building many GUIs, you can write a script which further automates the process. This might be a commandline tool with options like --toolbar (a boolean switch indicating whether to include a toolbar), --title (providing the argument to $mw->title()), and so on. This tool would create the skeleton code for you based on your template.

At the end of the day, choose whatever suits your needs best. Try to temper your choice with thoughts of: maintenance, extension, debugging, and so on.

-- Ken

Replies are listed 'Best First'.
Re^2: Easier GUI
by Anonymous Monk on Oct 17, 2010 at 06:16 UTC

    Thanks everyone for the answers.

    Has anyone tried creating the GUI in a different language (such as Java) and have it interact with the perl script ?

Log In?
Username:
Password:

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

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

    No recent polls found