|go ahead... be a heretic|
Re: Limits of Perl/tk?by tinman (Curate)
|on Apr 28, 2001 at 02:33 UTC||Need Help??|
I've used Perl/Tk for some applications... and I think its a very good GUI toolkit.. but, there are limitations that I've observed..
Firstly, the syntax is a bit awkward to pick up.. at least, I found it to be so.. some of the learning curve in Perl/Tk for me could have been because when I learnt it, I didn't understand OOP in Perl at all.. the concept of objects was unknown to me... but it looks different from the usual Perl code...
Although I hate to say this, I must concede that Swing, in recent years, has overtaken Tk in extensibility and functionality.. Having programmed quite a bit in Swing, it seems to have a lot of more breadth in widget types now than before...
Ok, now, onto the good stuff, and believe me, there is a lot that Tk has going for it.. Spreadsheets, yes, definitely possible...see here for a module on this.. never used it myself, but I know it exists :o) Graphics programs, very definitely.. if you haven't already, fire up the widget examples that came with your Tk distribution and look at the Canvas examples.. I've seen wonderful examples of graphics related programming in Tk.. First person shooters, nope, not really.. can't say I've seen those... Some more experienced monks, please do correct me if I err, but Perl/Tk isn't the fastest for that sort of thing... I'd tell you to look at C or C++ for that sort of thing..
Speed wise, and memory consumption wise, Tk rules.. don't even bother running Swing unless you have 128+ mb of RAM.. but I completed a complex Tk application that ran perfectly on my ancient P200 with just 32mb of RAM on Win95... no swapping out to disk, at all... Part of this is due to what I consider to be a design drawback of Swing, in that it renders each and every component.. Tk takes the much more pragmatic approach of using native components (dialogs etc) where possible, so it runs faster and smaller than its Swing equivalent...
As far as Visual Basic goes, well, I have to say that its much easier to write quick'n'dirty GUI apps using it... although Perl has made advances with the use of tools like SpecTcl and SpecPerl... but there is one major advantage of using Tk over VB, and that is platform independence.. I have not had to change much code (mostly, I haven't had to change any code at all) to get an application to run on both Win32 and Linux..
I'd probably tell you to stick with Tk, its a rewarding GUI toolkit to use, but if you insist, WxWindows has a Perl binding.. I think its in beta, but I have used the Python binding, and I find it to be useful for some GUI building tasks.. YMMV..