#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::TableMatrix; my $top = MainWindow->new; my $stuff = {}; my $tg = $top->Scrolled( 'TableMatrix', -rows => 21, -cols => 11, -width => 10, -height => 20, -titlerows => 1, -titlecols => 1, -variable => $stuff, -selectmode => 'extended', -resizeborders => 'both', -titlerows => 1, -titlecols => 1, -bg => 'white', )->pack( -expand => 1, -fill=>'both' ); $tg->tagConfigure('active', -bg => 'gray90', -relief => 'sunken') ; $tg->tagConfigure('title', -bg => 'gray85', -fg => 'black', -relief => 'sunken') ; $top->Button( -text=>'modify', -command=> sub { $stuff->{'3,3'} = 'asfasf'; #&TMRefresh($tg); $tg->configure(-padx =>( $tg->cget(-padx))); }, )->pack; Tk::MainLoop; sub TMRefresh { #Required input TableMatrix object. #use to force matrix to update, a code trick return if (!$_[0]); $_[0]->configure(-padx =>($_[0]->cget(-padx))); } #########################################################################