Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Advice on writing GUI's in Perl

by batkins (Chaplain)
on Oct 26, 2003 at 01:31 UTC ( #302141=note: print w/replies, xml ) Need Help??

in reply to Advice on writing GUI's in Perl

I don't know of any IDE's for Perl, and I'm not really sure you need one. If you opt to go with Perl/Tk instead of the Gtk+ Perl bindings, you design your interface programmatically. IMHO, this is a better approach. After a bit of practice, you can often code a serious interface faster than you could drag-and-drop it into existence - and more often than not, that interface would be a lot cleaner aesthetically.

So I'd suggest looking into Perl/Tk and avoiding IDE's. Of course, that's just my own opinion, but if you decide to take my advice, then get Tk off CPAN, read its documentation, and get familiar with it. I highly recommend O'Reilly's Mastering Perl/Tk, butthere's at least one tutorial right here in the Monastery.

Also, the first time you use Tk, you might be a bit disheartened by its appearance - I was. Look at this node for a quick but extremely effective way of cleaning up Tk's appearance.

And if you don't belive me that Tk lets you make working UI's quickly, take a look at this sample:

use Tk; $mw = MainWindow->new; # the next two lines fix the default Tk aesthetics $mw->optionAdd("*font", "-*-arial-normal-r-*-*-*-120-*-*-*-*-*-*"); $mw->optionAdd("*borderWidth", 1)_; $e1 = $mw->Entry->pack; $e2 = $mw->Entry->pack; $sum = $mw->Label->pack; $mw->Button(-text => 'Compute', -command => sub { $sum->configure(-text => ($e1->get() + $e2->get())); })->pack; MainLoop;
That code creates a simple form with two entry boxes, an area for results, and a button to add the two entered values together and put the result into the result area. You'd be hard-pressed to write that kind of thing with a click-and-drool IDE and get it working as quickly as you could write a script like the above. But, hey, TMTOWDI. :-)

The computer can't tell you the emotional story. It can give you the exact mathematical design, but what's missing is the eyebrows. - Frank Zappa

Replies are listed 'Best First'.
Re: Re: Advice on writing GUI's in Perl
by SyN/AcK (Scribe) on Oct 26, 2003 at 16:49 UTC

    Thank you for your reply, and I will take Tk into consideration. I just always thought the GUI's in Tk were a bit ugly. The reason for wanting to use GTK+ was because the newest GTK+ supports Gnome themes, i.e. the programs you write take on the look and feel of the theme currenlty applied.

    The thing I would really like to do is to create a GUI that is highly customized to the way that I wanted it to look. I suppose I should've mentioned that before. I do not know how possible this is in Tk as I've never used it. If its possible, I'd gladly use it.

    I really like the way some applications look when you buy them, even if sometimes a different look makes them a little harder to use. I hoped that with GTK+ and a Gnome theme, I might be able to make a GUI that looks very close to what I'd like it to.

    If any of you have any advice on how to do something like that, I'd appreciate it. I'll definitely take more of a look at Tk, and Qt as you guys mentioned, and I definitely want to thank you all for your posts, especially the one with the link to the gtk-list.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2022-12-03 19:34 GMT
Find Nodes?
    Voting Booth?

    No recent polls found