#!/usr/bin/perl -w use Tk; require Tk::JBrowseEntry; my %color_of = ( "apple" => "red", "orange" => "orange", "grape" => "purple", ); my $MW = MainWindow->new( -title => 'Jbrowse', -name => 'Demo', ); my $var = "red"; my $tmp_jbe = $MW->JBrowseEntry(-textvariable=>\$var, -width=>10, -state=>'normal', -btntakesfocus=>0, )->pack(); $tmp_jbe->insert('end',\%color_of); my $but = $MW->Button( -text => "Print Value", -width => 30, -height => 3, -command => sub { my $value = $tmp_jbe->get(); print "Var = $var, Get Result $value\n"; } )->pack(); MainLoop;