Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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


In reply to Re: Easier GUI by kcott
in thread Easier GUI by meirgold

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-03-29 15:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found