Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

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

I find GladeXML-based programming very refreshing, I used to churn code based on Tk, and this code was a real spaghetti, gui stuff mixed with actions mixed with logic ... horrible.

With Gtk2 and GladeXML you write your code, and seperately you draw your application, glade spews xml describing how your app should look, and you write what this app should do.

And this work equally well under UNIX oses and under windoze ( although on windoze you have to go through painfull process of installing gtk and gladexml - in my case this requires installing compilers etc... ). And the code can look like this:

use Gtk2; use Gtk2::GladeXML; #This loads description of your GUI, from file named #app.glade open (GLADE, "<", $sharedir.$execname.'.glade'); my $gladebuf; while (<GLADE>) { $gladebuf .= $_; } close (GLADE); $gladexml = Gtk2::GladeXML->new_from_buffer($gladebuf); # # This way you get the object you want to work on: my $window=$gladexml->get_widget('window'); # There's nothing stopping you from doing this on-the-fly: $gladexml->get_widget('userName')->set_text($userName); ############ sub on_something_something { my $w=$gladexml->get_widget('SomeWidget'); $w->show_all(); $w->run(); $w->hide(); } # Gtk2->main; exit 0;

And now, you can easily modify your apps look without touching the code, for example, you can take some window and turn it into a tab, or reorganize forms etc etc... This sounds like a great thing for teams with separate UI-designer, but this kind of development feels great even for single person, it's just so much easier not having to think about both functionality and looks at the same time (even if you switch from one to another every second, it's easier to work if you've got two virtual desktops dedicated - one for code, another for GUI).


In reply to Gtk2 + GladeXML by Eyck
in thread Best GUI package for Perl ? by rbutcher

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 drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-03-29 14:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found