Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are good options for Windows GUI toolkits for a Perl program?

I am considering doing some automation of tasks on my Windows desktop (e.g. sorting through large collections of music/text/photo files, etc...).

Seeing how my main area of developer expertise is Perl on Unix, I'd prefer to stick to Perl for coding the business logic of whatever I need done, just for the sake of development efficiency.

The question is, if I want to slap some GUI on top of the work (ala Perl::Tk on Unix), what are my GUI toolkit options and which one would you recommend using?

Please note that I'd like this question to be a good learning opportunity to other SO users, so I would welcome ANY answers even if they don't necessarily satisfy my own limitations/needs listed below, although notes elaborating on how your solution relates to these considerations would be very welcome.

My considerations are mostly driven by the fact that I want a quickly developed tool for personal use to save myself time on tasks I now do manually.

  • Main consideration is Perlishness of development - "Easy things should be easy and hard things should be possible" as a Perl slogan goes. Especially the first part :)

  • Prefer (but not insist) to be as native as possible as far as components used. E.g. rather re-use Windows' file open dialog vs. having some custom Java dialog.

  • I would prefer to use something that would have a small learning curve (e.g. no need to learn intricacies of OLE/COM), since the goal here is speedy development of tools I need to simplify my life as opposed to developer education which I concentrate on areas more relevant to my day job :).

    But I definitely would love to get exposure to something new/cool while doing this, e.g. if some nice Monad based GUI components are suggested I'm definitely curious.

  • Performance matters (e.g. I may need to display a directory listing with >10000 files), but is not of paramount concern - I am a pretty good GUI designer and developer and can always architect my app and design a GUI to scale well if needed).

  • I would strongly prefer (though not insist on) a framework that does not force me to compile stuff. e.g. Perl libraries are more preferable to custom Java stuff I need to compile. But if the framework is perfect in all other respects, I'm open to a compiled solution (as long as it doesn't required me to purchase Visual Studio or somesuch - I want to build a Windows GUI front-end for personal use, not invest in becoming a Windows developer).

I'm pretty open and flexible outside of above constraints. Some ActivePerl/Strawberry Perl libraries, MS PowerShell based components - heck, if nothing better shows up I'll just install Apache on my PC and build a web front-end :)

like image 308
DVK Avatar asked Sep 21 '09 14:09

DVK


2 Answers

With respect to "perlishness" of the interface, I'd suggest plain old Tk. Unfortunately, it looks quite antiquated and non-win32-ish.

If you want native widgets, I think your best shots are using the native Windows GUI via Win32::GUI or Wx. I have no experience with Win32::GUI, but Wx is quite nice. It does, however, have a rather steep learning curve and the interface isn't very "perlish". The C++ roots show a little bit (for better or worse).

There are a few Tk-replacements that are actually thin wrappers around Tcl/Tk (I think Tcl::Tk and Tkx). They look more modern than Perl/Tk, but I have no hands-on experience with these either. If you're developing for Windows only, have a look at ActivePerl which comes with (I think) Tkx. Their ppm4 package manager is written using it and looks pretty nice!

like image 167
tsee Avatar answered Nov 16 '22 00:11

tsee


There are a number of options listed in perlfaq3 and some additional ones that aren't. I'm only familiar with the Tk-based ones.

Perl/Tk has the most "perlish" interface but it hasn't been updated to take advantage of tile (native/themed widget) support in the current version of Tk (and probably never will be). Tkx uses a different bridge to Tk. It allows access to everything in Tk (and it's faster, too) but the syntax is less perlish. Tkx is designed to be a thin wrapper over Tk; you have to consult the Tk documentation for most things and translate for using it from Perl. The Tcl/Tk module uses the same bridge as Tkx but supports a syntax that's mostly the same as Perl/Tk.

Whether or not you need to compile anything depends on which version of Perl you use. If you use Strawberry Perl you'll probably have to compile something no matter what toolkit you choose. ActivePerl distributions have included Tkx since sometime in the 5.8.x cycle and stopped bundling Tk as of 5.10, although it's still available via PPM. Tcl/Tk is available from CPAN but I haven't been able to get it to work with the Tk library that comes bundled with ActivePerl; you may need to install Tcl separately to use it.

Personally, I used to use Perl/Tk but now use Tkx.

like image 42
Michael Carman Avatar answered Nov 16 '22 02:11

Michael Carman