#! /usr/bin/perl use strict; use warnings; use 5.010; use Tk; use Tk::MListbox; my $width = 1184; my $height = 318; my $mw = MainWindow->new( -title => 'testing' ); $mw->geometry( join 'x', $width, $height ); my $menu = $mw->Menu( -type => 'menubar' ); $mw->configure( -menu => $menu ); my $listbox = $mw->MListbox( -columns => [ [ -text => 'name', sortable => 1 ], [ -text => 'num', sortable => 1 ], ], ); $listbox->insert( 'end', [ foo => 1 ] ); $listbox->insert( 'end', [ bar => 4 ] ); $listbox->pack(); $listbox->insert( 'end', [ fuz => 8 ] ); my $btn_update = $mw->Button( -text => 'update', -command => sub { _update_mlistbox( $listbox ) }, ); my $btn_quit = $mw->Button( -text => 'quit', -command => sub { exit 0; }, ); $btn_update->pack; $btn_quit->pack; sub _update_mlistbox { my $list = shift; # NOT WORKING #$list->deleteEntry(0, 'end'); # working $list->delete(0, 'end'); # update/insert new data $listbox->insert( 'end', [ 1 => 'foo' ] ); $listbox->insert( 'end', [ 4 => 'bar' ] ); } MainLoop(); __END__