#!/usr/bin/perl -w use strict; use Tk; use Tk::Zinc; my $mw = MainWindow->new(); my $zinc = $mw->Zinc(-backcolor => 'gray', -relief => 'sunken', -width => 400, -height => 300)->pack(-expand => 1, -fill => 'both'); my $xtermWidth = 300; my $xtermHeight = 200; ## this Frame is needed for including the xterm in Tk::Zinc my $xtermContainer = $zinc->Frame(-container => 1); my $xtid = $xtermContainer->id(); print "$xtid\n"; # converting the id from HEX to decimal as xterm requires a decimal Id my ($xtId) = sprintf hex $xtid; print "$xtId\n"; my $label = $zinc->add('text', 1, -text => "Hide xterm", -position => [150, 30]); my $dcontitem = $zinc->add('window', 1, -window => $xtermContainer, -position => [50, 75], -width => $xtermWidth+4, -height => $xtermHeight+4, -visible => 1); $zinc->bind($label, '<1>', \&hideShow); sub hideShow { if ($zinc->itemcget($label, -text) =~ /Hide/) { $zinc->itemconfigure($label, -color => 'yellow', -text => "Show xterm"); $zinc->itemconfigure($dcontitem, -visible => 0); } else { $zinc->itemconfigure($label, -color => 'black', -text => "Hide xterm"); $zinc->itemconfigure($dcontitem, -visible => 1); } } my $width = $xtermWidth/10; my $height = $xtermHeight/20; system("xterm -fn 10x20 -geometry ${width}x${height} -into $xtId &"); MainLoop(); __END__