#!/usr/bin/perl use strict; use Tk; my $mw = MainWindow->new; $mw->geometry('400x250'); my $canvas = $mw->Canvas( -bg => 'lavender', -relief => 'sunken', -width => 400, -height => 250)->pack(-expand => 1, -fill => 'both'); my $size=[200,200]; # size of the widget my $location=[50,12]; # position of widget my @strings2 = qw/apples bananas pears grapes/ x 5; $canvas->{"listbox"}=$mw->Scrolled("Listbox", -bg => 'white', -scrollbars => "e", -selectmode => 'extended', -width => (${$size}[0])/7, # some scaling -height => (${$size}[1]+12)/15); # scaling $canvas->{"listbox"}->insert('end',@strings2); # This works $canvas->createWindow(${$location}[0] ,${$location}[1], -anchor => "nw", -window => $canvas->{"listbox"}); MainLoop();