Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Tcl/Tk vs. Perl/Tk

by yosefm (Friar)
on Apr 01, 2004 at 20:18 UTC ( #341774=perlquestion: print w/replies, xml ) Need Help??
yosefm has asked for the wisdom of the Perl Monks concerning the following question:

Hi, all.

I've been tinkering with TCL lately, and I found that besides the horrible ugliness of that language, a simple 3 button program in Tk takes forever to load. I never tried any GUI Programming in perl so I don't know if I can improve the timing by just moving the code to Perl/Tk or Perl/Gtk or something. Any thoughts?


perl -e'$b=unpack"b*",pack"H*","59dfce2d6b1664d3b26cd9969503";\ for(;$a<length$b;$a+=9){print+pack"b8",substr$b,$a,8;}'
My public key

Replies are listed 'Best First'.
Re: Tcl/Tk vs. Perl/Tk
by kvale (Monsignor) on Apr 01, 2004 at 20:52 UTC
    Both Perl/Tk and Tcl/Tk use the same Tk codebase, so there will be no difference there. Typically perl seems to be faster at many things than tcl, so your grograms may run faster in the perl/Tk system. I do not know if the perl/Gtk toolkit would be faster, but it would be more complex to program for simple stuff.

    I have used Tcl/Tk graphical apps and never noticed an app that takes forever to load. To determine whether it is your program or a Tcl/Tk problem, try running wish from the command line.


Re: Tcl/Tk vs. Perl/Tk
by graff (Chancellor) on Apr 02, 2004 at 04:25 UTC
    I know some people tend to complain about the odd-looking syntax that is typically used in Perl/Tk scripts, but at least there are easy and sensible ways to do it differently, according to taste -- but the following strikes me as being something that isn't so hard to cope with for a "simple 3-button program":
    #!/usr/bin/perl use strict; use Tk; my $mw = MainWindow->new; $mw->Button(-text => 'First Button', -command => sub { print "You hit the First Button.\n" } )->pack; $mw->Button(-text => 'Second Button', -command => \&second_sub, )->pack; $mw->Button(-text => 'QUIT', -command => \&exit, )->pack; MainLoop; sub second_sub { print "The Second Button invokes a Named Subroutine.\n"; return; }
    I don't know what the same brainless app would look like in Tcl/Tk, or how long it would normally take to show up on the display and work. There's no noticeable delay running the perl script.
Re: Tcl/Tk vs. Perl/Tk
by zentara (Archbishop) on Apr 02, 2004 at 15:21 UTC
    I don't know about your speed problems, but I thought you might be interested to know that you can run Tcl and TclTk programs from a perl script. Look for TclTk-0.75 and Tcl-0.75 on cpan.

    I'm not really a human, but I play one on earth. flash japh

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://341774]
Approved by arden
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2018-04-22 03:16 GMT
Find Nodes?
    Voting Booth?