All my perl/Tk applications are using Tk via Tcl::Tk which allows me better flexibility.
I do this way:
use strict;
use Tcl::Tk;
my $int = new Tcl::Tk;
$int->Eval (<<'EOS');
# here goes Tk code to construct GUI
pack [text .t]
pack [button .b -text button]
EOS
# and here goes main code with perl/Tk syntax
my $txt = $int->widget('.t','Text');
$txt->insert('end',"text text tex");
$int->MainLoop;
This has proven to be very convenient for all my Tk-GUI projects.
Indeed, separated GUI and logic,much easier to maintain than ordinary perl/Tk code. Perl/Tk, in the contrary, is much more noisy than Tcl/Tk GUI.
|