$C{'Select All'} = [ command => 'Select All', -command => [ sub { select_all(@_); }, $c ] ]; Here's the select_all sub # # Select all proteins in a canvas. # # Input: $c canvas # Output: - # Global: %global trace_me(); my ($c) = @_; our (%global); Globals->debug(1, "select_all called.\n"); my (@list, $count, $pb, $pct_complete, $step, $tag, $tag_count); @list = grep(/^id/, map { $c->gettags($_) } $c->find('all')); $tag_count = $#list; $step = int($tag_count / 15); $pb = progress_bar({-title => 'Selecting all proteins', -variable => \$pct_complete, }); $pb->Busy(); # Loop through tags and select. foreach $tag (@list) { # Skip if already selected. next if (exists($global{$c}->{selected}->{$tag})); # Change outline to selected. $global{$c}->{selected}->{$tag} = $c->itemcget($tag, '-fill'); $c->itemconfigure($tag, -fill => 'black', -outline => 'blue', -width => 2); $global{$c}->{selected_count}++; $count++; if ($count % $step == 0) { $pct_complete = ($count / $tag_count) * 100; $pb->update(); } } select_update($c); $pb->Unbusy(); $pb->destroy(); }