use strict; use Tcl::Tk; my $mw = Tcl::Tk::tkinit; my $int = $mw->interp; $int->Eval(<<'EOS'); # here goes pure-Tk GUI creation package require BWidget package require tooltip menu .menu -tearoff 0 menu .menu.file -tearoff 0 menu .menu.help -tearoff 0 .menu.help add command -label {brief explanation... (F1)} -command explainBox .menu.help add command -label {About...} -command aboutBox .menu.file add separator .menu.file add command -label Exit -command {destroy .} .menu add cascade -menu .menu.file -label File .menu add cascade -menu .menu.help -label Help . config -menu .menu wm title . {Here goes the title} pack [text .t -wrap none -font "Courier 8"] -expand 1 -fill both pack [button .b -text "test button" -command "puts this"] -fill x tooltip::tooltip .b "helper tooltip" # and now 2 helper dialog boxes: proc aboutBox {} { Dialog .about -modal local -separator 1 -title {about...} pack [message [.about getframe].m1 -text {author - me}] .about add -name Ok -text Ok .about setfocus 0 .about draw destroy .about } proc explainBox {} { Dialog .explain -modal local -separator 1 -title {brief explanation} set vt [.explain getframe] pack [message $vt.m1 -text {This program does foo bar fluffy, bla-bla-bla} -width 450] .explain add -name Ok -text Ok .explain setfocus 0 .explain draw destroy .explain unset vt } bind . explainBox bind . aboutBox EOS # bind Tcl/Tk widget to the perl/Tk my $t = $int->widget(".t",'Text'); # do anything with perl/Tk syntax $t->insert('end','some-text'); $t->see('end'); $int->MainLoop;