#!/usr/bin/perl -w use strict; use warnings; use feature qw{ say }; use Tk; use Tk::Optionbox; my $default_vsel = "Amazon"; my @options = ( 'option1', 'option2', $default_vsel, 'option4', ); my $mw = Tk::MainWindow->new(-title => 'Tk::Optionbox example'); my $vsel = $default_vsel; my $variableFont = 'Arial'; my $newTop = $mw->Frame->pack(-expand => 1, -fill => 'x'); my $selectVendor = $newTop->Optionbox( -command => \&select_vendor, -textvar => \$vsel, -font => $variableFont, -options => [@options], -rows => 15, )->pack(-side=>'left'); Tk->MainLoop; sub select_vendor { my $vendor = shift; say "Vendor is '$vendor'"; }