batkins has asked for the wisdom of the Perl Monks concerning the following question:

Can anyone tell me about the advantages and disadvantages of Tk and wxPerl?

I have a Perl script currently implemented in Tk, but the size of Tk's library and the ugliness of Tk::Tree have inspired me to look for alternatives.

Size is important because my program will be redistributed as an EXE and then downloaded over HTTP. I'd like to get the distro as small as possible.

I don't mean to start a holy war with this post, but I am curious about wxPerl.

Replies are listed 'Best First'.
Re: Tk vs. wxPerl
by dree (Monsignor) on Dec 14, 2002 at 00:36 UTC


    - looks like the window manager of the O.S. (e.g. on Win32 it looks like the standard windows applications, so no look or functionality problems)
    - relatively "hard" to program (it is strongly OO)
    - on win32 its dll is 1250K + (it has to "wrap" the instructions to bind the API of the WM)
    - multiplatform (soon also on Mac OS X)
    - young (not wx library that is 10 yeras old) but it's growing up and it is developed by a IMHO great programmer, Mattia Barbon.
    - not so well documented
    - perl2exe is not working so well with wxPerl, perlapp ok


    - it has its own look and feel
    - well documented (a book) and supported (a newsgroup)
    - mature software
    - multiplatform
    - on win32 its dll is around 500K (plus other dll for widgets)
    - both perl2exe and perlapp work well with Perl/Tk

    If you need multiplatform you can look at Prima that is a GUI with its own look and feel, multiplatform, 2d design and animation oriented, with a lot of widgets.

    If you're programming on Win32 you could look at Win32::GUI, that works only on Win32 but it is light because use Win32 GUI API "directly".
      - relatively "hard" to program (it is strongly OO)

      not so well documented
      Hogwash. It's plenty documented.

      As for the size, just use UPX like everybody, and be happy (Wx.dll size went from 1,416,192 to 248,832 bytes, now that's compression ~ Tk.dll went from 491,520 to 199,680)

      You know what, i'm gonna convince Mattia to distribute it that way to begin with.

      update: You can also embed Scintilla's fancy syntaxt hilighting widget into all your wxPerl apps (c/c++,perl,html....)

      MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
      ** The Third rule of perl club is a statement of fact: pod is sexy.

        The above node Re: Tk vs. wxPerl is obviously IMVHO, so *for me* procedural programming is easy than OOP.

        For example, *for me* is easier to write the hello world written in Tk
        use strict; use Tk; my $mw = MainWindow->new( -height => 100, -width => 350); $mw->title ("Hello, world!"); MainLoop;
        than wx one:
        use strict; use Wx; package MyApp; use vars qw(@ISA); @ISA = qw(Wx::App); sub OnInit { my( $this ) = shift; my( $frame ) = MyFrame->new(); $this->SetTopWindow( $frame ); $frame->Show( 1 ); } package MyFrame; use vars qw(@ISA); @ISA = qw(Wx::Frame); sub new { my( $this ) = shift->SUPER::new( undef, -1, 'Hello, world!', [200,200] , [350, 100] ); return $this; } package main; my( $app ) = MyApp->new(); $app->MainLoop();
        So IMVHO to programming wxPerl you have to know more Perl than to programming with Tk.

        Documentation issue: Tk has 3 books from O'Reilly, several chapters inside other books (Advanced Perl Programming, Professional Perl Development, others?), 1 newsgroup with years of posts, searchable with or with, years of development with tons of scripts aka large community.

        wxPerl unfortunately has only a mailing list without a working search engine and few excellent tutorials.

        But Perl/Tk is years old and wxPerl is young. This scenario is IMVHO the normality.

        DLL issue: my dir command on win32 says those dimensions. Only this.

        Update: fixed typos
        WOW! upx is awesome. thanks for the link.
Re: Tk vs. wxPerl
by PodMaster (Abbot) on Dec 14, 2002 at 00:24 UTC
    How much code is it?

    What kinds of widgets do you use?

    Forget holy wars, you're talking red v. green apples. wxPerl is still in betatesting (the porting started very short ago, but you can do lots and lots and lots and lots and lots with it).

    I like wxPerl more because it's just plain easier for me to mess with (especially now, with wxXRC).

    I'm creating wxChatter, a wxPerl chatterbox client, and the reason I chose Wx is cause i want it to run everywhere, including win9x, and with Wx::Process, you can attach a subroutine to be executed after an asynchronous proccess finishes)

    And furthermore, the newest version of tk (still only dev. release), is only gonna run on perl 5.7 and up, which sucks!!

    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    ** The Third rule of perl club is a statement of fact: pod is sexy.