Programming

From Stu2
Jump to navigation Jump to search

I'm somewhat familiar with Perl, which is a cross platform scripting language. It's not as fast as C, C++, etc, but it's very flexible and there is a lot of support on the web. I am trying to understand how to add a nice looking GUI to some of my scripts. Here are my notes about the current options, which seem like I might be able to use. There seems to be three generic ways to build a GUI on linux; 1) using GTK, 2) QT and 3) wxWidgets. In all three cases, Perl really isn't the language of choice.

gtk-perl

Glade is a GUI builder that produces a XML file. Using libglade, a program can use the XML file to display the GUI and provide event driven signals. This is nice because it separates the GUI design from the program files. It's also apparently portable.

  • gtk-perl - provides perl bindings to gtk+
    • installed Glib, GTK2, GTK2::GladeXML and Cairo from the sourceforge web site
  • glade - GUI to create user interfaces, produces an XML file, installed through ubuntu and using glade vesion 3.
    • Note, glade-2 had a 'build' button, but glade-3 removes code generation and relies on libglade
  • GTK2::GladeXML - Perl module which reads the glade XML file

wxWidgets

wxWidgets - this looks promising. To use it, a fellow should really program in C++. However, there are bindings for other languages. Specifically, there is wxPerl - which provides a perl wrapper for the wxWidgets.

  • the main programming target is C++ (lots of programming options here, e.g. kdevelop can be configured to use wxWidgets)
  • wxPerl provides perl bindings to the wxWidgets, but the documentation is terrible (i.e. limited)
  • wxGlade is a python script for generating GUIs using the widgets. Looks pretty good. Can generate some perl code, but looks like it's more complete with C++ or Python
  • visualWX is alpha and didn't try it.

QT

From Trolltech. Spent a lot of time with this because the designer looks really nice. It's designed to work best with C++, however, using translations (e.g. enter Perl code, instead of C++) you can generate Perl programs. Unfortunately, QT Designer had a memory leak and the screens smeared when I moved them around. This made the program unusable and caused me to look elsewhere.

Older stuff

I found some other avenues, but these appear to be old.

  • Glade::GeneratePerl - similar to GTK2::GladeXML, but older.
  • glade2perl - but this is old and not under development. glade2perl-2 never worked for me. (I spent hours chasing an error Gtk2/Window.pm can't be found. Never understood why. I think it's a problem with the script itself.)